I have an application with an FragmentActivity
called MainActivity
which holds two fragments, one menu fragment to the left and one content fragment to the right. On a large device both of these fragments are shown. On a small device only the menu fragment is shown and when the user presses an item in said menu the content fragment is displayed in a new Activity
.
Lets say the user is currently using the application on his phone and only the menu is visible:
The ActionBar
of MainActivity
can be manipulated by user choices in the menu. When the user selects a specific menu item, a new Activity
launches to display the content fragment. When this Activity
pops up the ActionBar
of this new Activity
is a new ActionBar
and therefore does not resemble the ActionBar
of FragmentActivity
(MainActivity
).
I figured I could pass the ActionBar
from MainActivity
to the Activity
which displays the content fragment through Intent
extras, or making the ActionBar
static and reference it like MainActivity.actionBar
or similar, but I ran into problems very quickly :)
Any suggestions on how to solve this? Basically, what I want is to share a single ActionBar
reference between all my activities.