0

I am implementing Tab environment as follow :

There is one class TabScreenABCActivity extends TabActivity,in that i have handled the tabchange functionality.

I have implemented MyTabGroupActivity extends TabGroupActivity. From this class, i have called MyActivity like so:

startChildActivity(getResources().getString(R.string.MyActivity), new Intent(this,MyActivity.class));

Now, MyActivity extends TabGroupActivity, from this class i called two other classes using intent like so:

Intent intent=new Intent();
intent.setClass(MyActivity.this,XYZActivity.class);
TabGroupActivity tab = (TabGroupActivity) MyActivity.this.getParent();
tab.startChildActivity("Tab", intent);

I have also overridden method to go back Activity onBackPressed() method in each activity. But it is not working properly. Can anyone guide me on how to handle it?

bool.dev
  • 17,508
  • 5
  • 69
  • 93
Bhavik Goswami
  • 163
  • 1
  • 11
  • You'll find some idea when you have a look at [here](http://ericharlow.blogspot.com/2010/09/experience-multiple-android-activities.html) – Praveenkumar Oct 16 '12 at 09:28
  • `onBackPressed()` works for me. Please provide some code. – shkschneider Oct 16 '12 at 09:32
  • plz check this http://stackoverflow.com/questions/5675194/android-tabactivity-back-button-functionality-with-multiple-child-activities – Sumant Oct 16 '12 at 09:35

2 Answers2

0

You can refer the below link for perfect TabGroupActivity Handling multiple activies under single tab

jagan g
  • 31
  • 8
0

This is code for hard back Button of your device. here put your intent.

public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {

             Intent i = new Intent(Activity1.this,Activity2.class);
                 startActivity(i);  

            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
Jeetu
  • 686
  • 2
  • 10
  • 20