9

To open an URL in a browser from other android app is simple:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://stackoverflow.com"));
startActivity(intent);

In this way, however, the URL always opens in NORMAL TAB in android browser.


What can I do to open an URL in PRIVATE TAB or INCOGNITO MODE from other android app?

Kara
  • 6,115
  • 16
  • 50
  • 57
nam
  • 387
  • 4
  • 7

1 Answers1

-5

Add flag= FLAG_ACTIVITY_NO_HISTORY

Intent yourIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(yourUrl));
yourIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
context.startActivity(yourIntent);
  • 4
    This is incorrect. FLAG_ACTIVITY_NO_HISTORY only removes the **activity** from the history (so that the hardware back-button doens't remember it. – Vitaly Kushner Sep 28 '13 at 20:04