A factory class to set up a MenuItem or a
      MediaRouteButton
      to be used as a Cast button. The SDK will set a MediaRouteSelector
      which is built by the CastContext,
      based on the discovery options set inside CastOptions.
Public Method Summary
| static void | |
| static MenuItem | 
                 
                  
                  setUpMediaRouteButton(Context
                  context, Menu menu, int
                  menuResourceId)
                   
              
                    Sets up the  
                MediaRouteActionProvider
                    in menu.
                   | 
            
| static Task<Void> | 
                 
                  
                  setUpMediaRouteButton(Context
                  context, Executor
                  executor, MediaRouteButton button)
                   
              
                    Sets up the given  
                MediaRouteButton
                    with an asynchronous call, which will not block the caller thread.
                   | 
            
| static Task<MenuItem> | 
                 
                  
                  setUpMediaRouteButton(Context
                  context, Executor
                  executor, Menu menu, int
                  menuResourceId)
                   
              
                    Sets up the  
                MediaRouteActionProvider
                    in menu with an asynchronous call, which will not block the caller
                    thread.
                   | 
            
Inherited Method Summary
Public Methods
public static void setUpMediaRouteButton (Context context, MediaRouteButton button)
Sets up the given MediaRouteButton.
Parameters
| context | The application Context. | 
              
|---|---|
| button | The MediaRouteButton
                instance to set up. | 
              
Throws
| IllegalStateException | If this method is not called on the main thread. | 
|---|
public static MenuItem setUpMediaRouteButton (Context context, Menu menu, int menuResourceId)
Sets up the MediaRouteActionProvider
            in menu. Returns the MenuItem of
            the MediaRouteActionProvider.
Parameters
| context | The application Context. | 
              
|---|---|
| menu | Menu reference. | 
| menuResourceId | The resource id of the cast button in the xml menu descriptor file. | 
Throws
| IllegalArgumentException | If menu doesn't contain a menu item with
                menuResourceId identifier, or the menu item doesn't have a
                MediaRouteActionProvider. | 
              
|---|---|
| IllegalStateException | If this method is not called on the main thread. | 
public static Task<Void> setUpMediaRouteButton (Context context, Executor executor, MediaRouteButton button)
Sets up the given MediaRouteButton
            with an asynchronous call, which will not block the caller thread.
Note that 
            ModuleUnavailableException could be thrown when the SDK fails to load the
            internal Cast module. The caller will get the exception from Task.getException()
            when the task completes.
Parameters
| context | The application Context. | 
              
|---|---|
| executor | An Executor
                to load the internal Cast module if needed. | 
              
| button | The MediaRouteButton
                instance to set up. | 
              
Throws
| IllegalStateException | If this method is not called on the main thread. | 
|---|
public static Task<MenuItem> setUpMediaRouteButton (Context context, Executor executor, Menu menu, int menuResourceId)
Sets up the MediaRouteActionProvider
            in menu with an asynchronous call, which will not block the caller thread.
            Returns the MenuItem of
            the MediaRouteActionProvider.
Note that 
            ModuleUnavailableException could be thrown when the SDK fails to load the
            internal Cast module. The caller will get the exception from Task.getException()
            when the task completes.
Parameters
| context | The application Context. | 
              
|---|---|
| executor | An Executor
                to load the internal Cast module if needed. | 
              
| menu | Menu reference. | 
| menuResourceId | The resource id of the cast button in the xml menu descriptor file. | 
Throws
| IllegalArgumentException | If menu doesn't contain a menu item with
                menuResourceId identifier, or the menu item doesn't have a
                MediaRouteActionProvider. | 
              
|---|---|
| IllegalStateException | If this method is not called on the main thread. |