email - android how to use startActivityForResult for doing action after coming back from mail composer -
i'm sending email, need go different activity when user comes email composer, how accomplish this?
here code, //send mail
string prestarttypestring = prestarttype; string = "juanman234@gmail.com"; string subject = "pre-start - "+prestarttypestring; string message = fullname+" has sent pre-start checklist equipment " +registrationnumber+".\n" + "please find pdf report attached. \n\nneed viewing report\nemail anytime at\nhello@tiks.com.au"; intent email = new intent(intent.action_send); email.putextra(intent.extra_email, new string[]{ to}); email.putextra(intent.extra_subject, subject); email.putextra(intent.extra_text, message); //attachment uri uri = uri.fromfile(new file(environment.getexternalstoragedirectory(), "generato.pdf")); email.putextra(intent.extra_stream, uri); //need prompts email client email.settype("message/rfc822"); startactivity(intent.createchooser(email, "choose email client :")); setresult(result_ok, email);
i have checked
startactivityforresult();
but dont have clear if way it, , have not make work
so how trigger function when user comes email intent?
thanks
start activity startactivityforresult(); , override following method
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, data); //place code here want when result returned, in case go different activity }
this method invoked when called activity returns result
Comments
Post a Comment