Friday, August 24, 2012

Re: [android-developers] Using startActivity( intent ) multiple times, fails.

Does this help?
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT

Also, why are you restricting the user to a specific email program ("com.android.email")?  That doesn't follow good Android practices...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Aug 23, 2012 at 8:16 AM, Mark Jawdoszak <eviljawdy@gmail.com> wrote:
I have an intent that starts the default Android mail client:

Intent emailIntent = this.getPackageManager().getLaunchIntentForPackage( "com.android.email" );
this.startActivity( emailIntent );

Very simple stuff, and it fires off the Email client, from an "Import from Email" button in my app.

My application is also registered with an <intent-filter> to open PDF files.
So, if I use the above Intent to open up the Email client, find an email with a PDF attachment, download it, launch it, select my application from the chooser... then everything loads great.

Now if I hit my "Import from Email" button again, the intent runs, but the Email client is never brought into the foreground.

Am I missing something when using startActivity() to (re)launch the correct app?
I have tried checking if the intent is OK by following this http://developer.android.com/training/basics/intents/sending.html#Verify but it always returns true (and that makes sense, as it can find the Application, but it's just not bringing it to the foreground).

I have also tried using startActivityForResult(), but as explained in the Android docs, this fires off a "cancel" immediately, because the Activity is not Explicit, but Implicit (thought I'd try it, just in case).

I feel like I'm missing something, a step, a call to something... or have I hit upon some strange loop that works in one case, but cannot keep looping?  Any help/pointers would be greatly appreciated!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment