Differentiating between an Activity launch from home screen or from another activity from App

前端 未结 7 1279
借酒劲吻你
借酒劲吻你 2020-12-09 03:51

I need to know a generic way to distinguish between a call of activity from launcher and a call from another activity from inside my app, or a BACK on the activity stack

7条回答
  •  萌比男神i
    2020-12-09 04:29

    in 2 cases the onRestart(); called, 1.when activity come from background, 2.when the user reach the activity by back button then sample solution: use onBackPressed() function to set a flag.. so u know that onRestart called becouse of back button press... in onRestart () check the flag and reset it and....

提交回复
热议问题