android - Variable Stays Null -


i'm trying pass string between activities, ytadapter favorites. ytadapter:

        mholder.mvideofavorite.setonclicklistener(new view.onclicklistener() {         @override         public void onclick(view v) {              //////////////////////////////////////////////////////////////             // need send searchresult result here favorites //             ////////////////////////////////////////////////////////////              apputils.showtoast(result.getsnippet().gettitle() + " added favorites.");             intent intent = new intent(mactivity,favorites.class);             string vidid,vidtitle,vidthumbnail;              vidid = result.getid().getvideoid(); //video id             vidtitle = result.getsnippet().gettitle(); //video title             vidthumbnail = result.getsnippet().getthumbnails().getmedium().geturl(); //video thumbnail              intent.putextra("id",vidid);             intent.putextra("title",vidtitle);             intent.putextra("thumbnail",vidthumbnail);          }     }); 

and try in favorites:

      /*getting video information ytadapter*/     vidid = getintent().getstringextra("id"); <--- stays null     vidtitle = getintent().getstringextra("title"); <--- stays null     vidthumbnail = getintent().getstringextra("thumbnail"); <--- stays null 

i'm accessing favorties 3rd activity, not straight ytadapter.

try in main class:

intent = new intent(listviewactivity.this, editcontact.class);         bundle bundle = new bundle(); bundle.putint("index", itemid);         bundle.putboolean("addcontact", false);         i.putextras(bundle);         startactivity(i); 

and can data in other class this:

bundle bundle = getintent().getextras();         if (bundle != null) {             int index = bundle.getint("index");             boolean bool = bundle.getboolean("addcontact");             if (bool ) {                 settitle("add contact");             } else {                 settitle("edit contact");                                 } 

i hope help.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -