Why does onResume() seem to be called twice?

后端 未结 2 639
暗喜
暗喜 2021-01-12 02:02

I have my Activity class here:

public class CameraActivity extends Activity {

private Camera mCamera;
private CameraPreview mPreview;

public void onCreate(         


        
相关标签:
2条回答
  • 2021-01-12 02:39

    I have found out that this- Where is this toast coming from? causes the camera preview to refresh again.

    It is the ES File Explorer app that generates an "Internal Storage Space left" toast which, I guess pauses the Camera preview for a brief moment and the onResume() has to be called again. Disabling that toast message no longer causes the pause and refresh on the Preview.

    Thanks everyone for helping. :)

    0 讨论(0)
  • 2021-01-12 02:42

    I've encountered the same problem and can confirm with NeilDA.

    ES File Explorer interrupts my app's activity lifecycle! It causes an onPause which promptly leads to the 2nd onResume. (I didn't see any toast however)

    And this only happens after being opened for the first time after installation or built from studio. Afterwards, I can restart the app as many times and that double onResume won't ever happen again.

    I checked this after force stoping ES File Explorer, re-built my app, and the double onResume doesn't happen. Then reopened ES File Explorer, re-built again, and the double onResume is back!

    So I uninstalled ES File Explorer.

    0 讨论(0)
提交回复
热议问题