简体   繁体   English

摄影机意图会重新创建我的活动并破坏我所有的应用程序对象

[英]camera intent recreates my activity and destroys all my app objects

Camera intent kills my activity. 相机意图会杀死我的活动。 I think it is due to an outofmemory error. 我认为这是由于内存不足错误引起的。 This happens in s4 alone, but sometimes it works correctly. 仅在s4中会发生这种情况,但有时它可以正常工作。 I'm calling the following intent. 我在说以下意图。 When save button is pressed the activity recreated. 按下保存按钮后,将重新创建活动。

Intent i=new Intent(MediaStore.ACTION_IMAGE_CAPTURE); 意图i =新意图(MediaStore.ACTION_IMAGE_CAPTURE);

Save your objects in the onSavedInstanceState() method. 将对象保存在onSavedInstanceState()方法中。 For more information about the Android lifecycle and when you should retrieve/save objects go here: http://developer.android.com/reference/android/app/Activity.html 有关Android生命周期以及何时应检索/保存对象的更多信息,请访问此处: http : //developer.android.com/reference/android/app/Activity.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM