如何在Android上管理startActivityForResult? - How to manage startActivityForResult on Android?
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. 另外,在准备MediaRecorder
或MediaPlayer
如果发生问题,那么我将关闭此活动。
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]startActivityForResult启动singleTask的Activity,则onActivitResult()立即回调且resultCode为RESULT_CANCEL
- 『ANDROID』总结:调用startActivityForResult,onActivityResult无响应的问题
- Android:startActivityForResult 和 onActivityResult 问题
- 【Android实战】----调用startActivityForResult()后,onActivityResult()立即执行的问题
- Android使用 startActivityForResult 、 onActivityResult 时的注意事项
- Android:startActivityForResult 和 onActivityResult 问题[转]
- How to get file path in onActivityResult in Android 4.4
- Android初学习 - 调用startActivityForResult后,onActivityResult为什么立刻响应
- Android startActivityForResult()和onActivityResult()的用法
- Android:startActivityForResult 和 onActivityResult 问题
- Android_Activity_startActivityForResult和onActivityResult问题
- Android startActivityforResult后,onActivityResult立即响应
- Android的startActivityForResult()与onActivityResult()与setResult()参数分析,activity带参数的返回
- Android Fragment startActivityForResult没有调用onActivityResult
- Android中关于startActivityForResult()在activity不同启动模式下onActivityResult()的回调
- Android startActivityForResult onActivityResult 立即执行 和不执行的问题
- Android的startActivityForResult()与onActivityResult()与setResult()参数分析,activity带参数的返回
- Android startActivityForResult 与 onActivityResult
- Android startActivityForResult()和onActivityResult()的用法
- Android:startActivityForResult 和 onActivityResult 问题