How to return a result (startActivityForResult) from a TabHost Activity?

后端 未结 5 1872
悲哀的现实
悲哀的现实 2020-11-22 12:40

I have 3 classes in my example: Class A, the main activity. Class A calls a startActivityForResult:

Intent intent = new Intent(this, ClassB.class);
startAct         


        
5条回答
  •  醉话见心
    2020-11-22 13:32

    You could implement a onActivityResult in Class B as well and launch Class C using startActivityForResult. Once you get the result in Class B then set the result there (for Class A) based on the result from Class C. I haven't tried this out but I think this should work.

    Another thing to look out for is that Activity A should not be a singleInstance activity. For startActivityForResult to work your Class B needs to be a sub activity to Activity A and that is not possible in a single instance activity, the new Activity (Class B) starts in a new task.

提交回复
热议问题