gpt4 book ai didi

安卓 : How to kill programmatically the camera activity running in background?

转载 作者:行者123 更新时间:2023-11-29 16:25:35 26 4
gpt4 key购买 nike

这里发生的是我调用裁剪图像 Activity ,然后相机 Activity 在后台运行。当我完成这个 Activity 时,相机在后台仍然存在。那么如何以编程方式终止在后台运行的相机 Activity ?


Intent newIntent = new Intent();
newIntent.setAction("com.android.camera.action.CROP");<br/>
newIntent.setClassName("com.android.gallery", "com.android.camera.CropImage");<br/>
newIntent.setData(selectedImage);
startActivityForResult(newIntent, IMAGE_CROP

最佳答案

您应该让 Android 自行处理进程生命周期。当它需要更多内存时,它会杀死未使用的进程。如果您自己终止它,您还有可能在用户使用它时终止它,从而导致糟糕的用户体验。

关于安卓 : How to kill programmatically the camera activity running in background?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4154210/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com