Click here to Skip to main content
15,893,190 members
Home / Discussions / Android
   

Android

 
GeneralRe: How can we display the pop up message in android Pin
Richard MacCutchan18-Feb-15 7:42
mveRichard MacCutchan18-Feb-15 7:42 
QuestionRe: How can we display the pop up message in android Pin
David Crow19-Feb-15 5:07
David Crow19-Feb-15 5:07 
QuestionAndroid sharedPreferences not working on spinner Pin
pankaj78817-Feb-15 4:24
pankaj78817-Feb-15 4:24 
AnswerRe: Android sharedPreferences not working on spinner Pin
David Crow17-Feb-15 6:02
David Crow17-Feb-15 6:02 
QuestionRe: Android sharedPreferences not working on spinner Pin
pankaj78818-Feb-15 6:01
pankaj78818-Feb-15 6:01 
QuestionRe: Android sharedPreferences not working on spinner Pin
David Crow18-Feb-15 8:04
David Crow18-Feb-15 8:04 
QuestionAndroid Activity Service communication: which one is the best approach? Pin
angelo.mastropietro13-Feb-15 4:50
angelo.mastropietro13-Feb-15 4:50 
QuestionSending email via Intent Pin
Member 822518012-Feb-15 10:25
Member 822518012-Feb-15 10:25 
I have and app which requires sending emails with attachments.
This app contains many activities. Within one activity, I send an email using the following intent:
startActivityForResult(Intent.createChooser(emailIntent, "Email"), EMAIL_REQUEST);

This works fine. The email is sent.

The problem:

After email is sent, the app loads/goes to the startup activity, not the activity from which the email was sent.

(Also note: onActivityResult is never called)

How can I return to the activity which sent the email?


Code fragment:

Java
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, message);
emailIntent.setType("message/rfc822");

File publicFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File inFile = new File(publicFolder, "snapshot.PNG");
if (inFile.exists() && inFile.canRead()) {

    Uri uri = Uri.fromFile(inFile);
    emailIntent.putExtra(Intent.EXTRA_STREAM, uri);

    try {                startActivityForResult(Intent.createChooser(emailIntent, "Choose an Email client :"), EMAIL_REQUEST);
        isSuccess = true;
    }
    catch (Exception e) {
        Toast.makeText(getApplicationContext(), "startActivity() exception thrown while sending email", Toast.LENGTH_SHORT).show();
   }
}


modified 13-Feb-15 11:19am.

AnswerRe: Sending email via Intent Pin
Richard MacCutchan12-Feb-15 22:53
mveRichard MacCutchan12-Feb-15 22:53 
QuestionRe: Sending email via Intent Pin
David Crow13-Feb-15 5:41
David Crow13-Feb-15 5:41 
AnswerRe: Sending email via Intent Pin
Member 822518013-Feb-15 7:12
Member 822518013-Feb-15 7:12 
SuggestionRe: Sending email via Intent Pin
David Crow13-Feb-15 8:07
David Crow13-Feb-15 8:07 
GeneralRe: Sending email via Intent Pin
Member 822518013-Feb-15 10:26
Member 822518013-Feb-15 10:26 
QuestionChinese Gifts for provide solution of challenge QR-code scanning requirement Pin
Member 114409179-Feb-15 21:51
Member 114409179-Feb-15 21:51 
QuestionHelp with app Pin
jjamesx27-Feb-15 12:11
jjamesx27-Feb-15 12:11 
QuestionRe: Help with app Pin
David Crow12-Feb-15 7:41
David Crow12-Feb-15 7:41 
Questionprobleme l'hors d'installation des packages android SDK manager Pin
Member 114299235-Feb-15 7:20
Member 114299235-Feb-15 7:20 
SuggestionRe: probleme l'hors d'installation des packages android SDK manager Pin
Richard MacCutchan5-Feb-15 22:05
mveRichard MacCutchan5-Feb-15 22:05 
Questiondisplay image from remote sqlserver db in Android Pin
Member 5933975-Feb-15 0:58
Member 5933975-Feb-15 0:58 
AnswerRe: display image from remote sqlserver db in Android Pin
Richard MacCutchan5-Feb-15 2:46
mveRichard MacCutchan5-Feb-15 2:46 
SuggestionRe: display image from remote sqlserver db in Android Pin
David Crow5-Feb-15 4:04
David Crow5-Feb-15 4:04 
Questionmobile commerce android Pin
Member 114251573-Feb-15 16:39
Member 114251573-Feb-15 16:39 
AnswerRe: mobile commerce android Pin
Richard MacCutchan3-Feb-15 23:02
mveRichard MacCutchan3-Feb-15 23:02 
QuestionSmall App Help Pin
Asimmmm24-Jan-15 5:10
Asimmmm24-Jan-15 5:10 
AnswerRe: Small App Help Pin
Vidyasagar Patro7-Feb-15 7:03
Vidyasagar Patro7-Feb-15 7:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.