Tajuddin Khandaker
Tajuddin Khandaker

Reputation: 722

Prevent an android activity to go pause state when HOME button is pressed

While using an editor activity I will prevent a HOME button press. But... I have tried Key events catching up on activity nothing hits there. also tried onUserLeaveHint() to show a confirmation dialog.

I started activity like following

final Intent intent = new Intent(activity, A.class);    
intent.setFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivityForResult(intent, "EDITOR");

any idea what could be a good practice to achieve this?

Upvotes: 0

Views: 311

Answers (1)

user15841268
user15841268

Reputation:

I don't think its possible to do, you cannot override Home button press and hence you cannot prevent your activity to go to in pause state. actually it goes to stop state when you click on home. first pause and then stop.

Upvotes: 1

Related Questions