Hiren
Hiren

Reputation: 305

Android Application Single Instance

I have one problem in notification click event.

for example there is a four activity in application A,B,C,D.

Currently Activity B is open and i get notification ,when i click on notification i want to open activity D. and its its working fine but problem is when i click back button from actvity D, its open activity B. I tried Intent.FLAG_ACTIVITY_CLEAR_TOP , Intent.FLAG_ACTIVITY_NO_HISTORY ,Intent.FLAG_ACTIVITY_SINGLE_TOP etc but still unsuccessful finish all intent.

please help me ,Thank you in advance.....

Upvotes: 1

Views: 430

Answers (2)

Hiren
Hiren

Reputation: 305

i found the solution, add flag in new Intent Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY

Upvotes: 1

gnclmorais
gnclmorais

Reputation: 4971

If I understood your problem correctly, I think you have to override the back button, in order to give it a custom behaviour. Something like this:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        // Go to previous activity, or some other place
    }

    return super.onKeyDown(keyCode, event);
}

Upvotes: 0

Related Questions