Tema: [ CONSULTA ] Pasar variable
Ver Mensaje Individual
  #17  
Viejo 24/10/18, 01:00:28
Array

[xs_avatar]
Merche300 Merche300 no está en línea
Betatester oficial
 
Fecha de registro: dic 2008
Localización: Valencia
Mensajes: 625
Modelo de smartphone: NEXUS 5 - ONEPLUS 3
Tu operador: Pepephone
mocelet, no sabes la alegria que me da leer todo el currazo que te has pegado, muchas gracias. pero:

Código:
private val jornadasResources = listOf(
private subrayado en rojo lo quito.


Código:
requestJsonObject(res.jornada)
res.jornada subrayado en rojo

En el Logcat: Too many arguments for private final fun requestJsonObject(): Unit defined in com.ramon.rafelcf.Jornadas.FragJor


Bueno el otro dia, domingo, me puse a ver y leer como hacer eso de los botones y tampoco lo consegui, no con data class, sino con array, aqui te lo dejo, aunque no viene mal hacer funcionar tu codigo. Tambien me ahorro 29 Strings.

Esto es lo que hice por si te sirve de algo, si quieres el enlace de donde lo saque no tienes mas que pedirlo:

Código:
val numJor = intArrayOf(R.id.tv_01, R.id.tv_02, R.id.tv_03, R.id.tv_04, R.id.tv_05,
R.id.tv_06, R.id.tv_07, R.id.tv_08, R.id.tv_09, R.id.tv_10, R.id.tv_11, R.id.tv_12,
R.id.tv_13, R.id.tv_14, R.id.tv_15, R.id.tv_16, R.id.tv_17, R.id.tv_18, R.id.tv_19,
R.id.tv_20, R.id.tv_21, R.id.tv_22, R.id.tv_23, R.id.tv_24, R.id.tv_25, R.id.tv_26,
R.id.tv_27, R.id.tv_28, R.id.tv_29, R.id.tv_30)

val button = arrayOfNulls<Button>(numJor.size)

for(i in numJor.indices){
    button[i] = view.findViewById(numJor[i]) as Button
    val buttonValue = i+1
val buttonText = Integer.toString(buttonValue)

    button[i]!!.setOnClickListener {
miTexto.text = getString(R.string.Jornada) + " " + buttonText        
jornada = buttonText
requestJsonObject()
    }
}

Lo que no funciona en ninguno es el requestJsonObject(), no cambia la url.

Última edición por Merche300 Día 24/10/18 a las 06:29:28.
Responder Con Cita