samedi 6 juin 2020

using Array value instead of checkbox_id in if statement

My code in is android studio, kotlin language.

I have a checkbox with id: "Pencilbox". Now I have an Array in which the first column contains the name of objects, names are equal to their checkbox id, and the second column is the price of them. so Array:

  Pencil    5
  Pen       6
  Notebook  10

Now I want to find the price of objects that the user wants. So normally I have to use: if (Pencilbix.ischecked) {...}

But now, I want to use the first column of the array (as the string is equal to the checkbox id) instead of checkbox id, or:

if (Array[0][0].toString.ischecked) {...}

But it is wrong. Any Idea?




Aucun commentaire:

Enregistrer un commentaire