How to detect if came back from child activity?

后端 未结 4 1059
南旧
南旧 2021-02-20 06:35

How can I detect if an activity came to focus after pressing the back button from a child activity, and how can I execute some code at that time?

4条回答
  •  生来不讨喜
    2021-02-20 06:50

    The method you're looking for may be the onResume method you can implements in your mother class ;). You must know that the onResume is also called the first time you launch any activity. Look at the lifecycle of an activity : http://developer.android.com/images/activity_lifecycle.png

    Regards,

提交回复
热议问题