开发者

App launch in android

开发者 https://www.devze.com 2023-01-26 17:16 出处:网络
We can launch the app in two ways, 1 is form the app, clicking on device back button till we reach the android home screen and launching the app or 2nd is from the app we can click the device home but

We can launch the app in two ways, 1 is form the app, clicking on device back button till we reach the android home screen and launching the app or 2nd is from the app we can click the device home button and then we can launch.

How can we differentiate these to launches? In 2nd type launch onrestart will be called, onrestart will be called in some other cases also.

I want to do something in the 2nd type of launch.

Can any one tel me how to do this...

T开发者_StackOverflow中文版hanks in advance.


When it comes to what happens when the activity is started, you may want to look at the following link in the developer site.

http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

You may want to code based on the lifecycle of the activity rather than if the application was pushed to the background by the home key vs. by the back key. There could be different reasons the application was pushed to the background or closed. This is the expected way to handle application events.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号