android - App hangs with screen blackout on back press from external app -


i have share option in navigation drawer of app. on click, working fine go respective intent i.e. "share intent". issue on pressing button whatsapp , app hangs showing black screen. pressing again nothing , app has killed eventually.i using coordinator layout. below code snippets:

mdrawerlayout = (drawerlayout) findviewbyid(r.id.drawer_layout); sidemenu = (listview) findviewbyid(r.id.left_drawer); msidemenulistadapter = new sidemenulistadapter(this, mdrawerlayout); sidemenu.setadapter(msidemenulistadapter); 

adapter code:

 holder.share.setonclicklistener(new view.onclicklistener() {   @override   public void onclick(view v) {   mdrawerlayout.closedrawer(gravitycompat.start);   intent share = new intent();   share.setaction(intent.action_send);   share.settype("text/plain");   share.putextra(intent.extra_subject, "xxx");   share.putextra(intent.extra_text, "****"));   share.addflags(intent.flag_activity_new_task |                  intent.flag_activity_clear_top);   mcontext.startactivity(intent.createchooser(share, "share link!"));   }   }); 

tried different options using different intent.flag nothing seem working. please advise.

edit: asked below oncreate method. have starting code whole method quite big initializing lots of stuff.

@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.home_screen_new); 

i have have put usual methods:

@override     public void startactivityforresult(intent intent, int requestcode) {         super.startactivityforresult(intent, requestcode);     }      @override     protected void onresume() {         super.onresume();     }      @override     protected void onrestart() {         super.onrestart();     }      @override     protected void onsaveinstancestate(bundle outstate) {         super.onsaveinstancestate(outstate);     } 

finally found solution. there nothing wrong in code. com.google.android.gms:play-services:9.0.0 caused problems. removed , added specific dependencies. found solution here : after upgrading google play services 9.0.0, app hangs in dynamitemodulesc


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo