I've run into a weird occurrence with regards to my child activity's life-cycle methods. If I launch and close the activity enough times, there eventually comes a point where for some reason, upon launching, onPause
gets called immediately after onCreate
(skipping onResume
), which is then followed by onResume
being called twice in a row. This ends up causing a RuntimeException
in my onResume
.
Here's the code that starts my activity:
Intent intent = new Intent(MainActivity.this, RecorderActivity.class);
startActivityForResult(intent, AV_CAPTURE);
My onPause:
protected void onPause() {
camera.stopPreview();
camera.setPreviewCallback(null);
camera.release();
camera = null;
super.onPause();
};
I'm not really sure what else I can provide here, it's all pretty straightforward. finish()
is called to close the activity, etc.
I should also probably mention that the activity is being triggered from a Javascript Interface attached to a WebView. Another interesting thing to mention is that setting a breakpoint anywhere in the first code block above seems to prevent the issue from happening.