Dynamically creating a spinner and setting its Value from SQLite

前端 未结 1 1468
面向向阳花
面向向阳花 2021-01-15 04:37

Found my problem check under \"Update\" for the code

Okay, I have a problem loading the right value from Sqlite into my Spinner. Here is how my app

1条回答
  •  离开以前
    2021-01-15 05:27

    Okay so I have seemed to figure out my own answer, weeks later! The problem I was having is that i was unaware that my OnItemSelectedListener() gets called every time my adapter is set for my first spinner.

    So now realizing this, i set the first spinner in OnItemSelectedListener() then use this spinner id to set my second spinner adapter.(i.e based on the id I set the adapter of my second spinner to 1 of 3 choices.)

    After this adapter is set I use the value returned from my cursor to find the string in this adapter and set the spinner to the position of the string in my array.

    It all works great now and I will be putting the final code above under the UPDATE title. Thanks for all help.

    0 讨论(0)
提交回复
热议问题