android how to handle button send on send email activity
private void sendImage(String fileName,String toUser){
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("jpeg/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {toUser});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,
"go on read the emails");
File downloadedPic = new File(Environment.getExternalStorageDirectory(),fileName + ".jpg");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(downloadedPic));
startActiv开发者_如何学City(Intent.createChooser(emailIntent, "Send mail..."));
}
i have some problem with handle the sending email. i mean that after i have sent the email to the user i will finish the activity and reference to the previous activity. but i don't want that. i want after i send the email to the user i will reference to the next activity. how could i do this? please help ! thank you...
you can override OnActivityResult Method in your activity.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
Intent intentobj=new Intent(currentclassname.this,nextactivity.class)
startActivity(intentobj);
finish();
}
}
}
I think this helps you.
精彩评论