java - ArrayList pass a null using Bundle -


currently have arraylist wanted pass activity. i've applied getparcelablearraylistbut pass null activity. i've check array null, it's not. in current activity before pass @ least.

this code:

recyclerviewoffline.java

toast.maketext(context,"clicked", toast.length_short).show();  intent intent = new intent(view.getcontext(),offlineactivity.class);  log.d("contexts test : ", filecontents.get(holder.getlayoutposition()).gettitle());  bundle bundle = new bundle(); //bundle.putparcelablearraylist("link",filecontents); bundle.putparcelablearraylist("arraylist",filecontents); bundle.putint("position",holder.getlayoutposition());  intent.putextra("bundle",bundle); view.getcontext().startactivity(intent);   

my receiving end:

offlineactivity.java

 bundle extras = getintent().getbundleextra("bundle");   if(extras != null) {    this.filecontents = extras.getparcelablearraylist("arraylist");    layoutposition = extras.getint("position");    log.d("contexts test offline: ",""+ filecontents.get(layoutposition).gettitle());     }  else{} 

as can see

you didnt add arraylist in parcelable in , out method , contructor.

this solve issue.


Comments