How to prevent Android to restart application afte

2019-05-18 07:20发布

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?

2条回答
三岁会撩人
2楼-- · 2019-05-18 07:20

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.

查看更多
一夜七次
3楼-- · 2019-05-18 07:29

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.

查看更多
登录 后发表回答