0

what is the difference between rotate the screen and called finish() method on activity, if any difference found then please list the method

how can i differentiate, this time screen rotated or called finish method on activity

2 Answers2

1

When orientation change the following methods of activity life cycle is called

  1. onSaveInstanceState()
  2. onPause()
  3. onStop()
  4. onCreate()
  5. onStart()
  6. onRestoreInstanceState()
  7. finally onResume()

If you dont call onSaveInstanceState() during rotation occurs the activity loads again from onCreate() you can go through this link for detail explaination

Community
  • 1
  • 1
Maniya Joe
  • 761
  • 6
  • 24
0

On rotation onfinish() is called. You can save your state by using "onSaveInstanceState" method. However there are 2 ways to handling this. here is complete description: Managing state for orientation

Community
  • 1
  • 1
Qandil Tariq
  • 539
  • 1
  • 3
  • 15