• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to change the value of one spinner based on the value selected from other spinner?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am a newbie to Android and am currently working on a form based application. It has two spinners and a couple to EditTexts. The issue that I am facing right now is that when I select a value in the first spinner the value corresponding to the the first spinner should show up in the second spinner. Th JSON values (two text files) are stored in the app itself under the assets folder. Here s what I have done so far:



I am able to populate the two spinners but I am not able to change the value of second spinner based corresponding to the position of the value selected on the first spinner. I know I am doing something wrong here. I wold be very grateful if someone could tell me where I am doing wrong.
 
Saloon Keeper
Posts: 7597
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the onItemSelected method being called, and does the output in line 131 have the correct value? If so, what happens in the loop in lines 146 to 150 - is the condition in line 147 ever true? Have both parts of the == comparison precisely the values you think they should have for each iteration of the loop? if you're not sure, log them all so you have something to base your debugging on.
reply
    Bookmark Topic Watch Topic
  • New Topic