Code example for MediaRouter.RouteInfo

Methods: getPresentationDisplay, isEnabled

0
  private void handleRoute(RouteInfo route) {
    if (route == null) {
      clearPreso(true); 
    } 
    else { 
      Display display=route.getPresentationDisplay();
 
      if (route.isEnabled() && display != null) {
        if (preso == null) {
          showPreso(route);
          Log.d(getClass().getSimpleName(), "enabled route");
        } 
        else if (preso.getDisplay().getDisplayId() != display.getDisplayId()) {
          clearPreso(true); 
          showPreso(route);
          Log.d(getClass().getSimpleName(), "switched route");
        } 
        else { 
          // no-op: should already be set 
        } 
      }