yogesh10
yogesh10

Reputation: 319

Open url in same tab in browser using android code(not using webview)

I am trying to open URL in browser in same tab. Instead of creating new tab(for same URL) of each click on android app.

Hers's is the code:

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://1.1.1.1:8008"));
intent.putExtra(Browser.EXTRA_APPLICATION_ID, "com.android.browser");
startActivity(intent);

If I close the browser and again restart the application I see URL opened in new tab, instead of open using existing tab.

Upvotes: 1

Views: 833

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007399

There are many Web browsers available for Android. Whether a browser even offers tabs to the user is up to the developers of the browser. For those that do offer tabs, how the browser handles ACTION_VIEW requests with respect to those tabs is also up to the developers of the browser.

There is nothing in the standard ACTION_VIEW protocol to say "please put this in an existing tab", largely because few things that support ACTION_VIEW have tabs.

It is certainly possible that some browsers offer some extra to control tab behavior with respect to ACTION_VIEW. You are welcome to contact the developers of those browsers and ask them.

Upvotes: 0

Related Questions