Example usage for android.provider Browser EXTRA_CREATE_NEW_TAB

List of usage examples for android.provider Browser EXTRA_CREATE_NEW_TAB

Introduction

In this page you can find the example usage for android.provider Browser EXTRA_CREATE_NEW_TAB.

Prototype

String EXTRA_CREATE_NEW_TAB

To view the source code for android.provider Browser EXTRA_CREATE_NEW_TAB.

Click Source Link

Document

Boolean extra passed along with an Intent to a browser, specifying that a new tab be created.

Usage

From source file:Main.java

protected static void launchFallbackSupportUri(Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(FALLBACK_SUPPORT_URL));
    // Let Chrome know that this intent is from Chrome, so that it does not close the app when
    // the user presses 'back' button.
    intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
    intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);
    intent.setPackage(context.getPackageName());
    context.startActivity(intent);//from  w  w w. j av a2  s.co  m
}

From source file:org.chromium.chrome.browser.download.OMADownloadHandler.java

/**
 * Shows a dialog to ask whether user wants to open the nextURL.
 *
 * @param omaInfo Information about the OMA content.
 *///from  ww  w. jav  a 2s.  co  m
private void showNextUrlDialog(OMAInfo omaInfo) {
    if (omaInfo.isValueEmpty(OMA_NEXT_URL)) {
        return;
    }
    final String nextUrl = omaInfo.getValue(OMA_NEXT_URL);
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflater.inflate(R.layout.next_url_post_oma_download, null);
    TextView textView = (TextView) v.findViewById(R.id.oma_download_next_url);
    textView.setText(nextUrl);
    final Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
    DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == AlertDialog.BUTTON_POSITIVE) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(nextUrl));
                intent.putExtra(Browser.EXTRA_APPLICATION_ID, activity.getPackageName());
                intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true);
                intent.setPackage(mContext.getPackageName());
                activity.startActivity(intent);
            }
        }
    };
    new AlertDialog.Builder(activity).setTitle(R.string.open_url_post_oma_download)
            .setPositiveButton(R.string.ok, clickListener).setNegativeButton(R.string.cancel, clickListener)
            .setView(v).setCancelable(false).show();
}