I've been working from the example applications from Google to prepare our Chromecast capabilities,
What I've found however is that you are required to have a button in the ActionBar (as implemented by Google) in order to get an ActionProvider in order to attach your selector to.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.main, menu);
MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem);
mediaRouteActionProvider.setRouteSelector(mCaster.getMediaRouteSelector());
return true;
}
Intact, the entire example and API seems to be hot-wired to centre around the use of this button. I'm fine with reproducing the look and feel the Android are trying to go with here - but I use a custom ActionBar in my app which means I don't have any "hooks" to select the route et al.
Does anyone know how to work around this?