I need to display MediaRouterActionProvider
as a menu item and have it displayed in the action bar of Main Activity which extends FragmentActivity()
;
The setup:
mainMenu.xml
<item
android:id="@+id/media_route_menu_item"
android:title="@string/media_route_menu_title"
app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
app:showAsAction="always"/>
private void setUpActionBar() {
mActionBar = getActionBar();
mActionBar.setLogo(R.drawable.ic_launcher);
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
mActionBar.setDisplayShowTitleEnabled(false);
mActionBar.setTitle("MediaRouter");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
I’m unable to display the menu item in actionBar. Is there a way in which i can get this working other that extending it to ActionBarActivity
?
The
v7
edition of theMediaRouteActionProvider
only works with theappcompat-v7
version of the action bar, which in turn requiresActionBarActivity
,Theme.AppCompat
, and kin.I have a cross-port of
MediaRouteActionProvider
that works with the native action bar.