android中如何用代码结束拍照的activity?
高洛峰
高洛峰 2017-04-17 17:57:48
0
3
322

假设我在activityA中打开相机:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
在相机拍摄过程中,收到来自服务器的message,需要在activityA中,执行某些操作,例如addview
但是activityA已经不再forground了,这个时候怎么用code来finish拍照的activity?或者有没有其他的思路?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
阿神

Can be updated when you return

Ty80

This kind of thing can only be done after returning from taking photos. You can save the message to another place first, and when you return to the Activity, check it during onResume to see if there is any unprocessed message, and update it if there is any.

小葫芦

I don’t think you need to close the activity that takes pictures. When you receive a message pushed by the server in the background, you can automatically pop up your activityA, that is, put your activityA in the foreground, or you can also pop up one in the notification bar. Notification allows the user to decide to continue taking photos or enter activityA, which can solve your problem.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template