android - Spinner value Changing based on parent spinner value changing -
hi , have 3 spinners .in want change second spinner value change based on first spinner value , third spinner change based on second spinner value values fetched , displayed database.i using arrayadapter .i searching last 2 weeks . dont solution kindly me running out of time pls.
may help,
arrayadapter<string> secondspinneradapter; arrayadapter<string> firstspinneradapter = new arrayadapter<string>( mainactivity.this, android.r.layout.simple_spinner_item, firstspinnervalue); first_spinner.setadapter(firstspinneradapter); firstspinneradapter .setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); firstspinner.setonitemselectedlistener(new onitemselectedlistener() { @override public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3) { // todo auto-generated method stub // data database add arraylist secondspinneradapter = new arrayadapter<string>( mainactivity.this, android.r.layout.simple_spinner_item, arraylistvalue); second_spinner.setadapter(secondspinneradapter); second_spinner.setselection(arg2, false); secondspinneradapter.setdropdownviewresource (android.r.layout.simple_spinner_dropdown_item); } @override public void onnothingselected(adapterview<?> arg0) { // todo auto-generated method stub } });
first spinner item selected, data database , fill arraylist , set secondspinner.
same way follow second spinner item selected.
Comments
Post a Comment