Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Starting app from 'recent applications' starts it with the last set of extras used in an intent
    primarykey
    data
    text
    <p>Bit of a confusing problem for me here:</p> <p>I've got a home screen widget which, when clicked, starts my main app Activity with a few extras put in the intent:</p> <pre><code>Intent start = new Intent(context, Main.class); start.putExtra("action", "showXYZ"); start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(start); </code></pre> <p>This all works fine, it starts my activity and my activity receives the extras as expected. It processes these extras and starts another activity.</p> <p>Once a user has clicked the home screen widget and started the Main activity in this way, going into the app through the 'Recent applications' method (holding down the 'home' key) starts the Main activity with the extras - causing processing to happen which I don't want (and leading to the second activity to open, rather than for the Main activity to just be shown).</p> <p>Is there any work-around for this? When starting the app from the 'recent applications' method, I want to simply start the Main activity without the last set of extras.</p> <p>Many thanks for the help! r3mo</p> <p>Note: I'm on android 1.5</p> <p>EDIT:</p> <p>Found a workaround here: <a href="https://stackoverflow.com/questions/3140072/android-keeps-caching-my-intents-extras-how-to-declare-a-pending-intent-that-kee">Android keeps caching my intents Extras, how to declare a pending intent that keeps fresh extras?</a></p> <p>I'm going to timestamp the intent being set off by the widget, and check that the timestamp is recent in Main.java. If it is, i'll proceed with the processing. If not, i'll just show the Main.java activity.</p> <p>Keen to hear if there are any official solutions to this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload