java - Passing data from activity to fragment transaction.replace() -


i have problem when passing data activity fragment(fragments overlapped): need pass arraylist integer contains id of checkboxes checked...

before passing data: enter image description here

after pass data: enter image description here

code pass data activity fragment:

 bundle bundle = new bundle();     bundle.putintegerarraylist("oki", hm);     system.out.println("pero:" + bundle);      mylistfragment myfragment = new mylistfragment();     myfragment.setarguments(bundle);     fragmenttransaction transaction = getsupportfragmentmanager().begintransaction();     transaction.replace(r.id.container, myfragment);       transaction.commit(); 

code data:

@override     public view oncreateview(layoutinflater inflater, viewgroup container,                              bundle savedinstancestate) {         // inflate custom_spinner_items fragment         //super.ondestroy();         try {         bundle = getarguments();          system.out.println("bundles:" + bundle);         //if (bundle != null) {                   strtext = bundle.getintegerarraylist("oki");                 system.out.println("ah:" + strtext);           //}         }catch(exception e){          } 

in mylistfragment

private arraylist marraylist;  public void setarraylist(arraylist arraylist) {     this.marraylist = arraylist; } 

you can access marraylist anywhere

then do

    bundle bundle = new bundle();     bundle.putintegerarraylist("oki", hm);     system.out.println("pero:" + bundle);      mylistfragment myfragment = new mylistfragment();     myfragment.setarraylist(hm);       fragmenttransaction transaction = getsupportfragmentmanager().begintransaction();     transaction.replace(r.id.container, myfragment);       transaction.commit(); 

Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -