3

I'm developing an application that uses tabHost. In that 5 tabs, Each and every single tab can open multiple activities. My problem is that in last tab (5th tab) I did the functionality of camera capture so it open camera and capture image but before call onActivityResult it call the first tab(1st tab) and after that call onActivityResult of last tab. But I do not know why this happens?

My code is here:

For create multiple activities I use this: http://ericharlow.blogspot.in/2010/09/experience-multiple-android-activities.html

TabPage:

public class TabPage extends TabActivity {

    Resources res;
    public static TabHost tabHost;
    TabSpec obj, obj1;
    Intent intent;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);     
        tabHost = getTabHost();
        res = getResources();

        obj1 = tabHost.newTabSpec("tab1");
        tabHost.addTab(obj1.setIndicator("",
                res.getDrawable(R.drawable.tab1)).setContent(
                new Intent(this, Act1.class)));
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));

        obj = tabHost.newTabSpec("tab2");
        tabHost.addTab(obj.setIndicator("",
                res.getDrawable(R.drawable.tab2)).setContent(
                new Intent(this, Act2.class)
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));

        obj = tabHost.newTabSpec("tab3");
        tabHost.addTab(obj.setIndicator("",
                res.getDrawable(R.drawable.tab3)).setContent(
                new Intent(this, Act3.class)
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));

        obj = tabHost.newTabSpec("tab4");
        tabHost.addTab(obj.setIndicator("",
                res.getDrawable(R.drawable.tab4)).setContent(
                new Intent(this, Act4.class)
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));

        obj = tabHost.newTabSpec("tab5");
        tabHost.addTab(obj.setIndicator("",
                res.getDrawable(R.drawable.tab5)).setContent(
                new Intent(this, Act5.class)));

            tabHost.setCurrentTab(0);

    }

    public void switchTab(int tab) {
        tabHost.setCurrentTab(tab);
    }

}
kalpana c
  • 2,739
  • 3
  • 27
  • 47

1 Answers1

2

Please check this links. May be it is useful for you.

Android onActivityResult NEVER called

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

Android Use startActivityForResult from a nested activity in a tab.

Community
  • 1
  • 1
kalpana c
  • 2,739
  • 3
  • 27
  • 47