Reputation: 6912
I use group for tabhost. In MyGroup, below code to call AActivity:
Intent intent = new Intent(this, AActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Window w = NASGroup.group.getLocalActivityManager().startActivity("AActivity", intent);
View view = w.getDecorView();
MyGroup.group.setContentView(view);
Show AActivity and menu button works. Then, I try use AActivity to call BActivity as below code:
Intent intent = new Intent(AActivity.this, BActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Window w = NASGroup.group.getLocalActivityManager().startActivity("BActivity", intent);
View view = w.getDecorView();
MyGroup.group.setContentView(view);
BActivity show, but the menu button does not work without any error message. I also try call BActivity by MyGroup as below code:
Intent intent = new Intent(this, BActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Window w = NASGroup.group.getLocalActivityManager().startActivity("BAActivity", intent);
View view = w.getDecorView();
MyGroup.group.setContentView(view);
BActivity show, and menu button works. If I still want to call BActivity by AActivity. How can I do?
Upvotes: 0
Views: 128
Reputation: 68177
Instead of adding separate menus in your child activity classes, add all the menus together in your parent class which extends ActivityGroup. and implement OnTabChangeListener
to detect the chosen activity tab and alter (show/hide) your menus accordingly
Upvotes: 1
Reputation: 18130
If I understand your question correctly:
In activity A:
Intent nextScreen = new Intent(getApplicationContext(), B.class);
startActivity(nextScreen);
and add this to your manifest:
<activity android:name=".B"></activity>
From http://developer.android.com/reference/android/app/Activity.html:
all activity classes must have a corresponding declaration in their package's AndroidManifest.xml
Upvotes: 1