How to prevent Android to restart application afte

2019-05-18 06:45发布

问题:

On low memory device I've got a problem after calling camera intent. When activity result should be received Android restart the whole app.

Have anybody faced same problem? Is there any solution?

回答1:

I faced the same issue a while ago: Android system stops application when launching Media Intent

Apparently there is no solution, so you have to make sure that you save and restore the application state.



回答2:

Well i think, the problem could be: Image byte array is too big such that it touches the limit and android restarts the application so following is what will i do:

  • Calling the intent with some parameter telling to downsample the bytes it gonna send back.

OR

  • Implement your camera using surfaceview and then when user takes some picture, save it temporarily on sdcard and return only the path... then get the path in onActivityResult and use the picture.

Hope it helps.