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.