Android how can i display the output on a spinner if it is on different activity -
on main activity there several buttons, when click button , there output e.g (rock||paper||scissor). use split separate , use intent go next activity. spinner on next activity, how can display separate outputs on spinner?
string data = "a||b||c||d"; string result[] = data.split("\\||"); arraylist<string> finaldatalist = new arraylist<string>(); for(int i=0; < result.length;i++) { system.out.println("at "+i+":"+result[i]); finaldatalist.add(result[i]); intent intent = new intent(activity1.this, activity2.class); intent.putstringarraylistextra("resultlist", finaldatalist); startactivity(intent); }
now can take result array using intent next activity.
//on activity 2
bundle bundle = getintent().getextras(); list<string> datalist = bundle.getstringarraylist("resultlist");
//now use data list in activity 2
Comments
Post a Comment