Created
March 22, 2018 12:53
-
-
Save mkaflowski/0f3d90cfe58d04c2b0820c32099b4d0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To add a Cast button, add the following snippet. | |
// menu.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" /> | |
// Then override the onCreateOptionMenu() for each of your activities. | |
// MyActivity.java | |
@Override public boolean onCreateOptionsMenu(Menu menu) { | |
super.onCreateOptionsMenu(menu); | |
getMenuInflater().inflate(R.menu.main, menu); | |
CastButtonFactory.setUpMediaRouteButton(getApplicationContext(), | |
menu, | |
R.id.media_route_menu_item); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment