问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/42249796/open-url-in-same-tab-in-browser-using-android-codenot-using-webview