How to prevent Android to restart application after calling camera intent?

百般思念 提交于 2019-12-10 09:43:25

问题


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.



来源:https://stackoverflow.com/questions/10617398/how-to-prevent-android-to-restart-application-after-calling-camera-intent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!