activity-lifecycle

onCreate called despite using FLAG_ACTIVITY_REORDER_TO_FRONT

时光毁灭记忆、已成空白 提交于 2021-02-10 22:17:21
问题 I have 2 activities (A and B) and they have 2 buttons to switch between. A oncreate B oncreate A oncreate A onresume what I wanted to do is after sending intent from B to A oncreate should not be called but at this point it does. To overcome that I found FLAG_ACTIVITY_REORDER_TO_FRONT (from here) and thought it could called only onresume but it didn't. 回答1: FLAG_ACTIVITY_REORDER_TO_FRONT does exactly what you think it should do. However, if you start ActivityA and then ActivityA starts

onCreate called despite using FLAG_ACTIVITY_REORDER_TO_FRONT

心不动则不痛 提交于 2021-02-10 22:13:19
问题 I have 2 activities (A and B) and they have 2 buttons to switch between. A oncreate B oncreate A oncreate A onresume what I wanted to do is after sending intent from B to A oncreate should not be called but at this point it does. To overcome that I found FLAG_ACTIVITY_REORDER_TO_FRONT (from here) and thought it could called only onresume but it didn't. 回答1: FLAG_ACTIVITY_REORDER_TO_FRONT does exactly what you think it should do. However, if you start ActivityA and then ActivityA starts

onCreate called despite using FLAG_ACTIVITY_REORDER_TO_FRONT

混江龙づ霸主 提交于 2021-02-10 22:10:40
问题 I have 2 activities (A and B) and they have 2 buttons to switch between. A oncreate B oncreate A oncreate A onresume what I wanted to do is after sending intent from B to A oncreate should not be called but at this point it does. To overcome that I found FLAG_ACTIVITY_REORDER_TO_FRONT (from here) and thought it could called only onresume but it didn't. 回答1: FLAG_ACTIVITY_REORDER_TO_FRONT does exactly what you think it should do. However, if you start ActivityA and then ActivityA starts

Is it possible that onPause() gets called if onResume() hasn't been called before?

蹲街弑〆低调 提交于 2020-06-17 07:57:10
问题 I register receiver in onResume() and unregister it in onPause() method. I can strange error in my Crashlytics reports: Fatal Exception: java.lang.RuntimeException Unable to pause activity {package-here}: java.lang.IllegalArgumentException: Receiver not registered: Caused by java.lang.IllegalArgumentException Receiver not registered: It happened 3 times (3 users) on 20k installs. Is it possible that onPause() gets called if onResume() hasn't been called before? I thought it isn't. 回答1: If it

Is it possible that onPause() gets called if onResume() hasn't been called before?

久未见 提交于 2020-06-17 07:57:08
问题 I register receiver in onResume() and unregister it in onPause() method. I can strange error in my Crashlytics reports: Fatal Exception: java.lang.RuntimeException Unable to pause activity {package-here}: java.lang.IllegalArgumentException: Receiver not registered: Caused by java.lang.IllegalArgumentException Receiver not registered: It happened 3 times (3 users) on 20k installs. Is it possible that onPause() gets called if onResume() hasn't been called before? I thought it isn't. 回答1: If it

RoboSpice requests results when user taps home button

徘徊边缘 提交于 2020-02-04 07:17:51
问题 We are using Robospice 1.4.12 with okhttp. Everything is working fine except getting the results from a request when user taps home button and then comes back to the activity. Example: we fire a request and then press home button and we wait for request to finish, when we come back to the activity the listener never gets notified. If we come back before the request finishes everything works ok. Orientation changes are working fine. We are using LruCacheObjectPersister for in memory cache. Now

Distinguish between pushing “home” button and opening another Activity

◇◆丶佛笑我妖孽 提交于 2020-01-22 14:52:09
问题 I have three activity: - SplashActivity - MainActivity - PlayerActivity Of course the app starts with SplashActivity, then it starts MainActivity and closes. MainActivity in some moment starts PlayerActivity and goes to backstack. (MainActivity is alive but is onStop) Then I need open MainActivity and set PlayerActivity to background (PlayerActivity is alive but is onStop). Then I need open PlayerActivity again and set MainActivity to background. So PlayerActivity and MainActivity often gets

Distinguish between pushing “home” button and opening another Activity

戏子无情 提交于 2020-01-22 14:51:46
问题 I have three activity: - SplashActivity - MainActivity - PlayerActivity Of course the app starts with SplashActivity, then it starts MainActivity and closes. MainActivity in some moment starts PlayerActivity and goes to backstack. (MainActivity is alive but is onStop) Then I need open MainActivity and set PlayerActivity to background (PlayerActivity is alive but is onStop). Then I need open PlayerActivity again and set MainActivity to background. So PlayerActivity and MainActivity often gets

What is the usage of onCreate method second implementation in Android Activities?

折月煮酒 提交于 2020-01-12 18:24:04
问题 I have alway used onCreate method inside my Activity lifecycle to start or restore from a saved state, but recently found that there is another onCreate method which contains a PersistableBundle : @Override public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); } I only found that it has been added since Android 21. Could anyone please give a complete information about this method, when it calls and the usage?

What is the usage of onCreate method second implementation in Android Activities?

半世苍凉 提交于 2020-01-12 18:21:46
问题 I have alway used onCreate method inside my Activity lifecycle to start or restore from a saved state, but recently found that there is another onCreate method which contains a PersistableBundle : @Override public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); } I only found that it has been added since Android 21. Could anyone please give a complete information about this method, when it calls and the usage?