简体   繁体   中英

Activity is destroyed when hit home button (only on Pixel3)

I have one big and long question

I have one activity with 4 fragments using viewPager. the first fragment also has 4 fragments using viewPager the second fragment has 6 fragments using general fragment way (replace or add on framelayout)

Here are my question and problem For example, I am in the first tab and in the second fragments, then hit homebutton and then bring my app upfront. after that suddenly all functionalities are not working. the back button is not working. the button in the fragment is not working. (error log said the fragment is not attatched) it happens only on pixel3.

I have 5 different android phones but working fine on those phones.

I thought it could be the memory issue, so I turned on "profiler" from Android Studio, and I saw the weird thing. only pixel3 when I pressed the home button the activity is destroyed. I tested all other phones with "Profiler" the activity's state is saved not destroyed.

Does anyone have the idea of why it happened and fixed the problem? Are the embedded fragments problem? or is it OS10 problem?

I found the issue. there is one option in developer mode named "Don't keep activities". that was on, that is why my app is working differently on pixel3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM