How to send the array data from one activity to fragment in android? -
How to send the array data from one activity to fragment in android? -
i building android application user select favorite stuff.
the name of stuff added in array when user clicks on stuff's image.
now want know how can parse value of array fragment , show in spinner list.
for example: user select mobile , tablet clicking on respective images these values added in array name 'stuffarray' want pass array fragment on 'submitted' button , when click on spinner of fragment should have mobile , tablet value in there list.
here code stuff selection :
submite = (imagebutton) findviewbyid(r.id.nextscreen); next.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub intent innext = new intent(getapplicationcontext(), mainactivitytabnew.class); startactivity(innext); }); img1 = (imagebutton) findviewbyid(r.id.imagebutton1); img1.setbackgroundresource(r.drawable.mobile); img1.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub isclicked1=!isclicked1; if (isclicked1) { img1.setimageresource(r.drawable.mobile); start(); stuff1 = "mobile"; mylist.add(stuff1); }else { img1.setimageresource(r.drawable.mobile); mylist.remove(sport1); //sport1 = ""; txt1.settext(""); } } }); img2 = (imagebutton) findviewbyid(r.id.imagebutton2); img2.setbackgroundresource(r.drawable.tablet); img2.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub isclicked2=!isclicked2; if (isclicked2) { img2.setimageresource(r.drawable.tablet); start(); stuff2 = "tablet"; mylist.add(stuff2); }else { img2.setimageresource(r.drawable.tablet); // sport2 = ""; mylist.remove(sport2); } } });
use
intent.putcharsequencearraylistextra(tag, arraylist);
and
getintent().getextras().getcharsequencearraylist(tag);
android arrays android-fragments
Comments
Post a Comment