您的位置:首页 > 移动开发 > Android开发

如何在Android上管理startActivityForResult? - How to manage startActivityForResult on Android?

2020-06-22 04:36 1166 查看

ECharts5.0版本即将上线,来说说我与ECharts的那些事吧!>>>

问题:

In my activity, I'm calling a second activity from the main activity by startActivityForResult . 在我的活动中,我正在通过startActivityForResult从主活动中调用第二个活动。 In my second activity there are some methods that finish this activity (maybe without result), however, just one of them return a result. 在我的第二个活动中,有一些方法可以完成此活动(可能没有结果),但是只有其中一个返回结果。

For example, from the main activity I call a second one. 例如,从主要活动中,我叫第二个活动。 In this activity I'm checking some features of handset such as does it have a camera. 在本活动中,我将检查手机的某些功能,例如是否带有摄像头。 If it doesn't have then I'll close this activity. 如果没有,我将关闭此活动。 Also, during preparation of MediaRecorder or MediaPlayer if a problem happens then I'll close this activity. 另外,在准备MediaRecorderMediaPlayer如果发生问题,那么我将关闭此活动。

If its device has a camera and recording is done completely, then after recording a video if a user clicks on the done button then I'll send the result (address of the recorded video) back to main activity. 如果其设备带有摄像头并且录制已完全完成,则在录制视频后,如果用户单击“完成”按钮,我会将结果(录制的视频的地址)发送回主要活动。

How do I check the result from the main activity? 如何检查主要活动的结果?

解决方案:

参考一: https://stackoom.com/question/hfNP/如何在Android上管理startActivityForResult
参考二: https://oldbug.net/q/hfNP/How-to-manage-startActivityForResult-on-Android
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android
相关文章推荐