Android:如何杀死程序化的相机活动在后台运行? [英] Android : How to kill programmatically the camera activity running in background?

查看:648
本文介绍了Android:如何杀死程序化的相机活动在后台运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里发生的是调用裁剪图片活动,然后相机活动在后台运行。当我完成这个活动,相机仍然活着的背景。那么如何以编程方式杀掉在后台运行的摄像机活动?

What happens here is I call the crop image activity and then the camera activity runs in background. When I finish this activity, the camera is still alive at the background. So how can I kill programmatically the camera activity running in background?


Intent newIntent = new Intent
newIntent.setAction(com.android.camera.action.CROP);

newIntent.setClassName(com.android.gallery,com.android.camera.CropImage) ;

newIntent.setData(selectedImage);
startActivityForResult(newIntent,IMAGE_CROP

推荐答案

当它需要更多的内存,它会杀死未使用的进程,如果你自己杀了,你也有风险杀死,而用户使用它,导致一个坏的用户体验。

You should let Android handle process lifecycle on its own. When it'd need more memory, it'll kill unused processes. If you kill it yourself, you also risk killing it while the user is using it leading to a bad user experience.

这篇关于Android:如何杀死程序化的相机活动在后台运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆