android - How to pass ArrayList using Intent? -
i want pass model arraylist using intent. case in activity , wants pass arraylist activity fragment. how can achieve this?
add code in activity:
bundle bundle=new bundle(); bundle.putserializable("key",mainlist); yourfragment chatfragment=new yourfragment (); chatfragment.setarguments(bundle);
add code in fragment:
@override public void oncreate(@nullable bundle savedinstancestate) { super.oncreate(savedinstancestate); bundle bundle=getarguments(); if(bundle!=null){ arraylist<object> list=(arraylist<object>)bundle.get("key"); } }
Comments
Post a Comment