5

I need to simulate a part of the lifecycle, from onPause to onResume event.

I used the back button to pause the app, when I enter the app again, it always to the onCreate event to start a new lifecycle.

How to make the app run from onPause to onResume directly ?

Thanks.

enter image description here

user403015
  • 7,209
  • 19
  • 66
  • 100

2 Answers2

2

well android use back button to remove activity from stack.

but if you don't want to remove activity from stack you can use home key for returning from app.

but if you still want back button to work like home button then you can refer here

Community
  • 1
  • 1
Sunil Pandey
  • 7,042
  • 7
  • 35
  • 48
1

try opening a dialog on press of a button. This will call the onPause. Close the dialog onResume will be called. Start a new activity onPause followed by onStop called. Press back onResume called

pankajagarwal
  • 13,462
  • 14
  • 54
  • 65
  • This answer now isnt actually correct as a simple AlertDialog isnt an Activity, thus "onPause" will not be called. I know this is already old, just found it during my search. – nouseforname Jan 12 '14 at 13:13