141

My Android app is getting called by an intent that is passing information (pendingintent in statusbar).

When I hit the home button and reopen my app by holding the home button it calls the intent again and the same extras are still there.

    @Override
    public void onSaveInstanceState(Bundle savedInstanceState) {
      super.onSaveInstanceState(savedInstanceState);
    }
    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
      super.onRestoreInstanceState(savedInstanceState);
    }

this is the code that doesn't run like its supposed to

    String imgUrl;
    Bundle extras = this.getIntent().getExtras();


    if(extras != null){
        imgUrl = extras.getString("imgUrl");
        if( !imgUrl.equals(textView01.getText().toString()) ){

            imageView.setImageDrawable( getImageFromUrl( imgUrl ) );
            layout1.setVisibility(0);
            textView01.setText(imgUrl);//textview to hold the url

        }

    }

And my intent:

public void showNotification(String ticker, String title, String message, 
    String imgUrl){
    String ns = Context.NOTIFICATION_SERVICE;
    NotificationManager mNotificationManager = 
        (NotificationManager) getSystemService(ns);
    int icon = R.drawable.icon;        // icon from resources
    long when = System.currentTimeMillis();         // notification time
    CharSequence tickerText = ticker;              // ticker-text

    //make intent
    Intent notificationIntent = new Intent(this, activity.class);
    notificationIntent.putExtra("imgUrl", imgUrl);
    notificationIntent.setFlags(
        PendingIntent.FLAG_UPDATE_CURRENT | 
        PendingIntent.FLAG_ONE_SHOT);
    PendingIntent contentIntent = 
        PendingIntent.getActivity(this, 0, 
        notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | 
        PendingIntent.FLAG_ONE_SHOT);

    //make notification
    Notification notification = new Notification(icon, tickerText, when);
    notification.setLatestEventInfo(this, title, message, contentIntent);
    //flags
    notification.flags = Notification.FLAG_SHOW_LIGHTS | 
        Notification.FLAG_ONGOING_EVENT | 
        Notification.FLAG_ONLY_ALERT_ONCE | 
        Notification.FLAG_AUTO_CANCEL;
    //sounds
    notification.defaults |= Notification.DEFAULT_SOUND;
    //notify
    mNotificationManager.notify(1, notification);
}

Is there any way to clear the intent or check whether it has been used before?

trejder
  • 17,148
  • 27
  • 124
  • 216
Mars
  • 4,197
  • 11
  • 39
  • 63
  • Can you post your codes? – xandy Nov 07 '10 at 01:49
  • I added the code to my question – Mars Nov 07 '10 at 15:35
  • Instead of clearing Intent, you could determine the launch type and handle the app flow accordingly. Get the Extras only if it is launched for the notification and not from background. http://stackoverflow.com/questions/4116110/clearing-intent/41381757#41381757 – B.B. Dec 29 '16 at 14:37

21 Answers21

203

UPDATE:

I didn't realise this answer would be referred to so much when I first wrote it more then 5 years ago!

I'll clarify to point out that as per @tato-rodrigo answer this won't help you detect an already handled intent in some situations.

Also I should point out I put "clear" in quotes for a reason - you are not really clearing the intent by doing this, you're just using the removal of the extra as a flag that this intent has been seen by the activity already.


I had exactly the same issue.

Above answer put me on the right track and I found even simpler solution, use the:

getIntent().removeExtra("key"); 

method call to "clear" the Intent.

Its a bit late answering since this was asked a year ago, but hopefully this helps others in the future.

Maks
  • 7,562
  • 6
  • 43
  • 65
  • 4
    doesn't the removeExtra() method take a String parameter ? like this getIntent().removeExtra("String"); – tony9099 Oct 17 '13 at 09:16
  • 32
    @Maks I might be wrong but I think this will not work in the following scenario: 1) Open the activity through the notification; 2) Finish the activity by pressing the back button; 3) Reopen the activity through the History (Recent Apps). Another case is when the system kills the app due a lack of resources (enable "Do not keep activities" under developer options and after that just press home then open the activity again from History). I posted the solution I'm using below. If you could comment on this would be nice. – tato.rodrigo Aug 27 '14 at 20:20
  • 3
    Unfortunately it doesn't work for us. We are finding that starting a new activity which in turn starts the initial activity causes OnNewIntent to fire again with the same intent. – Le-roy Staines Nov 20 '14 at 17:53
  • 2
    Instead of clearing Intent, you could determine the launch type and handle the app flow accordingly. Get the Extras only if it is launched for the notification and not from background. http://stackoverflow.com/questions/4116110/clearing-intent/41381757#41381757 – B.B. Dec 29 '16 at 14:39
  • 2
    Didn't work for me. I was facing the same issue as @tato.rodrigo mentioned where intent wasn't getting cleared if the activity is opened through notification or from history or other reasons he mentioned, so what I did after consuming the intent information was to reset the intent like this `setIntent(new Intent())` and its working fine now. – Shubhral Jun 20 '17 at 11:46
  • 1
    GUYS don't be blind, it's going to work until your activity is still alive, if it was destroyed then when you return to the activity you'll get again this intent – user25 Apr 22 '18 at 17:01
  • 1
    @tato.rodrigo you are totally right, we can enable **Don't keep activities** in **Developer Options** and see that it's not going to work – user25 Apr 22 '18 at 17:02
  • @Maks please edit your answer and add info about **tato.rodrigo**'s answer (because it really works in all cases, even after activity was destroyed and reopened from history stack/recent activities) – user25 Apr 22 '18 at 17:30
  • appreciate the reference to the other, more comprehensive answer – user2297550 Jul 01 '18 at 11:35
  • Feel free to star the issue: https://issuetracker.google.com/issues/143755680 – Ghedeon Nov 02 '19 at 14:02
55

EDIT: I'm editing to post the complete solution I'm using.

This solution will work if the problem is "Not execute some code when the activity starts from History (Recent Apps)".

First of all, declare a boolean in your Activity to indicate if the Intent was already consumed:

    private boolean consumedIntent;

Then, safely store and restore this value using the onSaveInstanceState and onCreate methods to handle configuration changes and cases that the system may kill your Activity when it goes to background.

    private final String SAVED_INSTANCE_STATE_CONSUMED_INTENT = "SAVED_INSTANCE_STATE_CONSUMED_INTENT";

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putBoolean(SAVED_INSTANCE_STATE_CONSUMED_INTENT, consumedIntent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //set content view ...

        if( savedInstanceState != null ) {
            consumedIntent = savedInstanceState.getBoolean(SAVED_INSTANCE_STATE_CONSUMED_INTENT);
        }

        //other initializations
    }

Now, check if you can run your code under onResume method.

    @Override
    protected void onResume() {
        super.onResume();

        //check if this intent should run your code
        //for example, check the Intent action
        boolean shouldThisIntentTriggerMyCode = [...];
        Intent intent = getIntent();
        boolean launchedFromHistory = intent != null ? (intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0 : false;
        if( !launchedFromHistory && shouldThisIntentTriggerMyCode && !consumedIntent ) {
            consumedIntent = true;
            //execute the code that should be executed if the activity was not launched from history
        }
    }

Additionally, if your Activity is configured to singleTop, you should reset your flag when a new Intent is delivered.

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        consumedIntent = false;
    }
tato.rodrigo
  • 2,783
  • 21
  • 26
  • 16
    Thanks a lot! Me has helped this code `(intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)` so now I can figure out when start of activity is from history and I can ignore my extras. – Roman Nazarevych Nov 24 '14 at 14:52
  • 1
    @Lemberg I have the same problem, and I have solved just like you, If you use some extras which came from push notifications, there is a risk to start your activity from history and aways consume your extras and redirect to the same action like your push notification. The flag launchedFromHistory can help you to know this – Stoycho Andreev Aug 31 '15 at 09:50
  • is it going to work even if activity was destroyed and we reopen it again from history stack? – user25 Apr 22 '18 at 17:14
  • great! it seems to work even if app was destroyed... but please @tato.rodrigo remove `boolean shouldThisIntentTriggerMyCode = [...];` from answer (what is used for?) – user25 Apr 22 '18 at 17:33
  • In my case with multi-notifications for certain user it's better user `consumedIntent` as `String` containing notification Uid. This Uid can be simply added to notification at the backend as current timestamp. Also you should save this Uid in `onSaveInstanceState` only if Intent has been coming form `onCreate`. This means you shouldn't save Uid from `onNewIntent`. – Konstantin Konopko Dec 16 '18 at 14:52
  • This answer should get a million upvotes. Thank you! – AndrzejO Aug 21 '23 at 21:17
33

When we launch Android apps from History (Recent Apps), the app could be launched with primarily three different Intent flags.

  1. FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
    This is when activity is being launched from history of an app that was minimised (long press home key).
    Constant Value: 1048576 (0x00100000)
  2. FLAG_ACTIVITY_NEW_TASK
    This is when activity is launched via "clicking application icon" or via "Intent filters". Here the activity will become the start of a new task on this history stack.
    Constant Value: 268435456 (0x10000000)
  3. FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY | FLAG_ACTIVITY_NEW_TASK
    This is when app was quit by pressing back button and then resumed from History (recent apps).
    Constant Value: 269484032 (0x10100000)

Constant value can be retrieved via getIntent().getFlags()

In the third case, Android reloads the last Intent values from its memory. So your app's intent (getIntent) will have values from the last intent that launched the app.

Actually, the app should behave as if it is a fresh launch, with intents values for a fresh launch rather than the intent values of the previous launch. This behaviour can be seen if you launch the app by clicking the app icon, it will never have old intent values. This is because, Android uses the following intent filter for this scenario

 <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER"/>
 </intent-filter>

But in the third case (App that was quit, is launched from History of Recent apps), Android OS uses that last intent that launched the app before it was quit (via pressing back button). So you end up having old intent values and the app flow is not proper.

Removing intent is one way of solving it, but it would not solve the issue completely! As Android OS reloads the Intent from the apps last launch, and not last instance of the launch intent.

A clean way to avoid this from happening, is to handle it via getting the type of Intent to determine the launch type.

So in your LaunchActivity (The one which has the intent filter defined in the manifest), you could use the following code in the onCreate(), onStart(), or onResume() methods.

if(getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) {
    //app is launched from recent apps after it was closed
        normalLaunch();
    } else {
        String intentAction = getIntent().getAction();
        String scheme = getIntent().getScheme();
        //app is launched via other means
        // URL intent scheme, Intent action etc
        if("https".equalsIgnoreCase(scheme)) {
            // URL intent for browser
        } else if("com.example.bb".equalsIgnoreCase(intentAction)) {
            // App launched via package name
        } else {
            // App was launched via Click on App Icon, or other means
            normalLaunch();
        }
    }

I presume normalLaunch(), should not use parameters from the Intent; otherwise you would need to segregate and optimise your default launch method not to use Intent parameters.

B.B.
  • 924
  • 2
  • 11
  • 28
  • 1
    Not all heroes wear caps! – Sdghasemi Jan 29 '18 at 15:36
  • I don't know but it always returns true `getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY` doesn't matter if I start activity from another activity (startActivity method) or reopen it from History stack (recent apps). – user25 Apr 22 '18 at 17:20
  • you would have to use it in combination with another flags, maybe FLAG_ACTIVITY_NEW_TASK – B.B. Apr 25 '18 at 17:06
  • 2
    This doesn't work when activity was killed in the background because of Dev settings "Don't keep activities". In this case getIntent()getFlags() is identical as when the activity started for the 1st time. – Malachiasz Nov 13 '18 at 13:03
  • appreciate the explanation but it doesn't as intended – Azlan Jamal Jun 25 '19 at 11:04
  • for 3rd scenario, it should be Intent.FLAG_ACTIVITY_REORDER_TO_FRONT – Azlan Jamal Jun 25 '19 at 11:17
  • For me, tapping on the app from the recent list always returns 268435456. – Bink Jun 07 '22 at 17:38
31

Clearing an intent object:

intent.replaceExtras(new Bundle());
intent.setAction("");
intent.setData(null);
intent.setFlags(0);
Mickey Tin
  • 3,408
  • 10
  • 42
  • 71
  • 2
    This should be the accepted answer. Works really well! – Martin Erlic Nov 26 '15 at 12:03
  • 5
    Does not work when "do not keep activities" is checked on developer options – Jemshit Jul 28 '17 at 06:55
  • Just removing the extra didn't work for me, it clears the intent while the fragment is in foreground, but trying to navigate back to it still has the extra stored. Just replacing the extra with a new bundle (`intent.replaceExtras(new Bundle()); `) is enough to clear whatever is settled as an extra. – Victor Oliveira Oct 15 '22 at 13:55
26

Maks answer works for clearing an extra:

    getIntent().removeExtra("key"); 

Another useful command is:

    getIntent().setAction("");

You could also tag an intent by calling:

    getIntent().putExtra("used", true);

and then just check for the value.

Slynk
  • 527
  • 5
  • 9
10

Short answer is No way

Long answer. There is no such thing as "one-shot" intent. From experiment it is observed that recent activity history in modern Androids is nothing more than "Intent history". The latest intent passed to activity is simply logged into system and that's the deal. Folks above suggest to use

setAction("")

But it does not work because the intent is already logged till the moment you get it inside onNewIntent() or onStart() method.

I solved the problem by avoiding use of intents. My problem was simmiliar to the one posted by the author. I tried to implement Global Exit from application via control in notification area. It should stop the underlying service and close all activities of the app. You can find same behavior in Waze application.

The algorithm:

  1. Create PendingIntent for notification control which passes "Exit" action to activity. But to the special activity which is a simple proxy.
  2. Proxy activity onStart() code parses the intent, checks action and sets the state of some model to "Exited".
  3. Proxy activity onStart() code clears original intent using setIntent("") and then forwards it to destination "Root" activity by calling startActivity(intent).
  4. Proxy activity onStart() code invoke finish().
  5. Inside onStart() and onNewIntent() of destination activity check model state and call finish() if it is "Exited" (and also call stopService() in my case).

I hope this will help to someone because I did not find the answer in the internet.

Eugene Wechsler
  • 147
  • 1
  • 3
  • I find this the most accurate answer, since "clearing the intent" does not necessarily mean "remove certain extra". I also don't think there is an easy way to do that. – mdelolmo Jul 28 '14 at 15:50
5

Make sure that you are using PendingIntent.FLAG_UPDATE_CURRENT flag for PendingIntent.

PendingIntent pendingIntent = PendingIntent.getActivity(this, 100, mPutIntent, PendingIntent.FLAG_UPDATE_CURRENT);

Where mPutIntent is your Intent.

Hope this will help you.

Hiren Patel
  • 52,124
  • 21
  • 173
  • 151
2

I recently had this problem and I solved it by adding a timestamp as a extra parameter to the intent:

private void launchActivity(Context context) {
    Intent intent = new Intent(context, MainActivity.class);
    intent.putExtra("KEY_EXTRA_TIMESTAMP", System.currentTimeMillis());
    context.startActivity(intent);
}

After that, save the timestamp to the shared preferences:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    long time = getIntent().getLongExtra("KEY_EXTRA_TIMESTAMP", -1);
    long previousTime = getPreferences(MODE_PRIVATE).getLong("timestamp", -1);

    //ignore if the timestamp is the same as the previous one  
    if (time != previousTime) {
        handleIntent(getIntent());
        if (time != -1) {
            //save the timestamp
            getPreferences(MODE_PRIVATE).edit().putLong("timestamp", time).apply();
        }
    }
}
1

When you are done processing the Intent, do this:

setIntent(null);

You won't see that processed Intent again, and you won't be masking the problem by editing the contents of the processed Intent.

straya
  • 5,002
  • 1
  • 28
  • 35
1

Even after manually clearing the Intent and Intent extras after they have been parsed, it seems as though Activity.getIntent() will always return the original Intent that started the Activity.

To get around this, I recommend something like this :

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // The Intent provided by getIntent() (and its extras) will persist through a restore
    // via savedInstance.  Because of this, restoring this activity from a
    // an instance that was originally started with extras (deep-link or 
    // pre-defined destination) may cause un-desired behavior
    // (ie...infinite loop of sending the user directly to somewhere else because of a
    // pre-defined alternate destination in the Intent's extras).
    //
    // To get around this, if restoring from savedInstanceState, we explicitly
    // set a new Intent *** to override the original Intent that started the activity.***
    // Note...it is still possible to re-use the original Intent values...simply
    // set them in the savedInstanceState Bundle in onSavedInstanceState.
    if (savedInstanceState != null) {
        // Place savedInstanceState Bundle as the Intent "extras"
        setIntent(new Intent().putExtras(savedInstanceState));
    }

    processIntent(getIntent())
}

private void processIntent(Intent intent) {
    if (getIntent().getExtras() == null) {
        // Protection condition
        return;
    }

    doSomething(intent.getExtras.getString("SOMETHING_I_REALLY_NEED_TO_PERSIST"));

    final String somethingIDontWantToPersist = 
        intent.getExtras.getString("SOMETHING_I_DONT_WANT_TO_PERSIST");

    if(somethingIDontWantToPersist != null) {
        doSomething(somethingIDontWantToPersist);
    }
}

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    // Save selective extras from original Intent...
    savedInstanceState.putString("SOMETHING_I_REALLY_NEED_TO_PERSIST", "persistedValued");
    super.onSaveInstanceState(savedInstanceState);
}

This way, there is a mechanism to dump the original Intent while still retaining the ability to explicitly retain certain parts of the original Intent / Intent extras.

Note that I haven't tested all Activity launch modes.

dell116
  • 5,835
  • 9
  • 52
  • 70
1

I couldn't find a way to remove Intent Extra. None of the answers about removing extra from intent works if you enable "Do Not Keep Activities" from Developer Options (That way you can destroy Activity and come back to test if Extras are still there).

As a solution to the problem, i stored boolean value in SharedPreferences after Intent Extras are processed. When same Intent is redelivered to the Activity, i check the SharedPreference value and decide to process the Intent Extra. In case you send another new Intent Extra to same Activity, you make SharedPreference value false and Activity will process it. Example:

// Start Activity with Intent Extras
Intent intent = new Intent(context, MyActivity.class);
intent.putExtra("someData", "my Data");
// Set data as not processed
context.getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE).edit().putBoolean("myActivityExtraProccessed", false).commit();
context.startActivity(intent);

...

public class MyActivity{

    ...
    public void someMethod(){
        boolean isExtrasProcessed = context.getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE).getBoolean("myActivityExtraProccessed", false);  
         if (!isExtrasProcessed) {
              // Use Extras

              //Set data as processed
              context.getSharedPreferences(BuildConfig.APPLICATION_ID, Context.MODE_PRIVATE).edit().putBoolean("myActivityExtraProccessed", true).commit();
         }
    }

}
Jemshit
  • 9,501
  • 5
  • 69
  • 106
  • preference doesn't make sense as you don't know if you started activity using startActivity or you reopen it from History Stack... – user25 Apr 22 '18 at 17:07
  • @user25 i think there was a way to detect if it is launched from recent apps. But does it matter, intent extra is either consumed or not, if it is consumed u know it from shared pref. i have used this for consuming push notification extra and it does not matter how activity is opened for my case. – Jemshit Apr 22 '18 at 17:14
1

I've got exactly the same problem. My solution was to add boolean variable that was set when Intent was 'used' and if statement based on this boolean to check if you should use Intent or not.

pixel
  • 24,905
  • 36
  • 149
  • 251
  • 4
    this might not work, as the boolean values will get recreated (if declared global in the activty) when the activity is stopped and then restarted. (clicking the home button for example) – tony9099 Oct 17 '13 at 09:14
1

It's not a good practice to add another extra just to know if the extras has been consumed or not, why not doing this?:

if (intent.hasExtra(EXTRA_NAME) && intent.getBooleanExtra(EXTRA_NAME, false)) {
    // consume extra here after that set it to false
    putExtra(EXTRA_NAME, false)
}   
Gilbert Parreno
  • 107
  • 1
  • 4
0

The straight forward way is to avoid calling getIntent() from methods other than onCreate(). But this will cause problem during next launch if the user left our Activity by tapping the Home button. I think this problem don't have a fully functional solution.

mifthi
  • 151
  • 8
0

I confront the same problem and try to use above methods but it doesn't work.

I think it may be cause of acitvity's launch mode which I used singleTop mode.

When I background app and use RamEater to simulate issue that intent always has extra even I set it null or remove key.

The problem is gone by using preference storage on Android to check that had pass through.

0

this worked for me...

private void getTheIntent() {
    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0 
            | (getIntent().getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {

        Log.i(TAG, "getTheIntent: Not from History !!!!!!!!!!!!!!!!!!!!!");
        // add your code .
    }
    else{
        Log.i(TAG, "getTheIntent: Launched from History !!!!!!!!!!!!!!!!!!!!!");
        //the activity is launched from history after being closed by back button or home button
        // it will go here and the above code will not be repeated.
    }

}
ahmdhosny
  • 21
  • 2
-1

How about this? Sets newIntent as the intent.

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
}
coolcool1994
  • 3,704
  • 4
  • 39
  • 43
  • 1
    I don't think that works. When the activity is recreated from history, the intent remains unaffected. – mdelolmo Jul 28 '14 at 15:52
-1

How about when you wish to clear the intent - replace it with an empty one?

eg.

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
}

@Override 
public void onResume() {
    super.onResume();

    Intent theIntent = getIntent();
    if ("myaction".equals(theIntent.getAction()) {
         handleIntent();
         onNewIntent(new Intent());  // <--- "clear" the intent by setting empty one
    }
}
Iftah
  • 9,512
  • 2
  • 33
  • 45
-1

This will hopefully help everyone. So first we get the intent

//globally
Intent myIntent;

Place this somewhere onCreate

myIntent = getIntent();
String data = myIntent.getStringExtra("yourdata");
//Your process here

Now lets set this so everytime our app gets destroyed or exited we will remove the data

@Override
protected void onDestroy() {
    //TODO: Clear intents
    super.onDestroy();
    myIntent.removeExtra("data");
}
@Override
protected void onBackPressed() {
    //TODO: Clear intents
    super.onBackPressed();
    myIntent.removeExtra("data");
}

You get the idea, if this is not enough just find more 'on' callbacks

-2

While the Intent.removeExtra("key") will remove one specific key from the extras, there is also the method Intent.replaceExtras(Bundle), which can be used to delete the whole extras from the Intent, if null is passed as a parameter.

From the docs:

Completely replace the extras in the Intent with the given Bundle of extras.

Parameters
extras The new set of extras in the Intent, or null to erase all extras.

Because the putXXX() methods initialize the extras with a fresh Bundle if its null, this is no problem.

Steve Benett
  • 12,843
  • 7
  • 59
  • 79
-3
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
intent.addCategory(Intent.CATEGORY_HOME);  
startActivity(intent);
forsvarir
  • 10,749
  • 6
  • 46
  • 77
Ramkumar
  • 93
  • 5
  • 2
    You should consider elaborating on your answer by providing some details about what it is you're doing and how it answers the OP's question. – forsvarir Jul 30 '12 at 12:29
  • 1
    @Ramkumar this takes the user to home. Which clearly is just a single case out of 10000 cases that might cause onPause, onStop or onDestroy get called. – tony9099 Oct 17 '13 at 09:18
  • 1
    This is not even remotely related to the question – Hossein Shahdoost Feb 25 '19 at 14:42