Pradeep Pradeep - 6 months ago 20
Android Question

onRestart -> onStart() what happen between this 2 state

I've 2 Activity A & B.. A starts B when i return from B to A onRestart() is called, then onStart() method is called.
My question is all the views in Activity A redraws when onRestart() -> onStart()?

Answer
  • Just onResume(.) is called if Activity A is not yet destroyed (variables are retained, no redraw).
  • If it's destroyed onCreate(.) > onStart(.) > onResume(.) is called(variables are lost, redraw).
  • If it's stopped onRestart(.) > onStart(.) > onResume(.) is called(variables are not lost, redraw)

Thus you'll only loose variables if the Activity is cleared from memory.