Return back to initiating activity after sending email in android -


i want return initiating activity after sending email invoking email client in android. not working @ all. have tried below code.

try {           path = android.provider.mediastore.images.media.insertimage(               getcontentresolver(), returnedbitmap, "diploma.png", null);           uri diplomauri = uri.parse(path);                    //send email above generated image attachment           final intent emailintent2 =                   new intent(android.content.intent.action_send);           emailintent2.putextra(intent.extra_subject,                                 "potty diploma teddy");           emailintent2.putextra(intent.extra_text, html.fromhtml(""));           emailintent2.putextra(intent.extra_stream, diplomauri);           emailintent2.settype("image/png");           startactivityforresult(intent.createchooser(emailintent2, "email:"),                                   email_success);       } catch(exception e) {           final alertdialog.builder builder =                  new alertdialog.builder(v.getcontext());        builder.settitle("device media access");        builder.setmessage("failed access media store of device");        builder.setcancelable(false);        builder.setpositivebutton("ok", new dialoginterface.onclicklistener() {         public void onclick(dialoginterface dialog, int which) {          dialog.cancel();         }        });        alertdialog alert = builder.create();        alert.show();          }   @override     public void onactivityresult(int reqcode, int resultcode, intent data){      super.onactivityresult(reqcode, resultcode, data);         switch(reqcode){           case (email_success):             if (resultcode == result_ok){              intent myintent = new intent(progress.this, igopotty.class);       myintent.putextra("tab_id", 2);       startactivity(myintent);             }         }     } 

it seems you're trying create new intent initial activity? why not setresult() , finish() in onactivityresult()? can't see you're trying without either more code or little more information on part. i'm assuming you're calling setresult(), , finish(), within email activity. "being" caught here in onactivityresult()? one, have set breakpoint , stepped through see if you're getting result whatsoever? if so, firing , isn't? if firing myintent != null, might scoping issue?


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -