Android : onActivityResult doesn't work on Tab

2019-08-01 10:02发布

问题:

I have a problem with calling onActivityResult. When I call startActivityForResult on normal Activity(with, onActivityResult works. I mean, starting application with FirstActivity,

Intent intent1 = new Intent(FirstActivity.this, SecondActivity.class);
startActivityForResult(intent1, CODE);

works well. However, starting application with TabActivity,

Intent intent2 = new Intent(this, FirstActivity.class);
mTabHost.addTab(mTabHost
    .newTabSpec("tabmenu")
    .setIndicator("menu1")
    .setContent(intent2));

then startActivityForResult(intent1, CODE) again, it only call SecondActivity but onActivityResult never called anymore. I didn't change any code, but changing starting activity on AndroidManifest.xml. What should I do calling onActivityResult with TabHost?

Thanks in advance.