List of usage examples for android.media.tv TvInputInfo loadLabel
public CharSequence loadLabel(@NonNull Context context)
From source file:com.android.tv.MainActivity.java
/** * Starts setup activity for the given input {@code input}. * * @param calledByPopup If true, startSetupActivity is invoked from the setup fragment. *//*ww w.j ava2 s . c o m*/ public void startSetupActivity(TvInputInfo input, boolean calledByPopup) { Intent intent = TvCommonUtils.createSetupIntent(input); if (intent == null) { Toast.makeText(this, R.string.msg_no_setup_activity, Toast.LENGTH_SHORT).show(); return; } // Even though other app can handle the intent, the setup launched by Live channels // should go through Live channels SetupPassthroughActivity. intent.setComponent(new ComponentName(this, SetupPassthroughActivity.class)); try { // Now we know that the user intends to set up this input. Grant permission for writing // EPG data. SetupUtils.grantEpgPermission(this, input.getServiceInfo().packageName); mInputIdUnderSetup = input.getId(); mIsSetupActivityCalledByPopup = calledByPopup; // Call requestVisibleBehind(false) before starting other activity. // In Activity.requestVisibleBehind(false), this activity is scheduled to be stopped // immediately if other activity is about to start. And this activity is scheduled to // to be stopped again after onPause(). stopTv("startSetupActivity()", false); startActivityForResult(intent, REQUEST_CODE_START_SETUP_ACTIVITY); } catch (ActivityNotFoundException e) { mInputIdUnderSetup = null; Toast.makeText(this, getString(R.string.msg_unable_to_start_setup_activity, input.loadLabel(this)), Toast.LENGTH_SHORT).show(); return; } if (calledByPopup) { mOverlayManager.hideOverlays(TvOverlayManager.FLAG_HIDE_OVERLAYS_WITHOUT_ANIMATION | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_FRAGMENT); } else { mOverlayManager.hideOverlays(TvOverlayManager.FLAG_HIDE_OVERLAYS_WITHOUT_ANIMATION | TvOverlayManager.FLAG_HIDE_OVERLAYS_KEEP_SIDE_PANEL_HISTORY); } }