On recent versions of Android, opening a link from Google Search it opens on a wrapped version of the Chrome within Google Search app and it offers a option on the menu to 'open with Chrome'. This common pattern is also seen on other apps like Facebook, Twitter, etc. So basically it opens the link on a 'WebView wrapper' within the app instead of opening the Browser app.
An interesting thing is found on the one from Google Search, that when you click on the 'open with Chrome' it plays a very smooth transition to Chrome, like if it would get transformed into Chrome.
Is there any sample or library that kinda helps or wraps this behavior? Or an 'in-app browser' that wraps this activity behavior.
The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout. It does not include any features of a fully developed web browser, such as navigation controls or an address bar. All that WebView does, by default, is show a web page.
Google combined WebView with Google Chrome for versions 7.0, 8.0 and 9.0. However, with Android 10.0, it went back to having it as a separate component. Users can update WebView in Android 10 through Google Play Store.
Android System WebView is a system component that lets Android apps display web content inside them without opening a dedicated browser. In other words, Android System WebView is a web browser engine or an embedded web browser dedicated solely for apps to show web content.
The loadUrl() and loadData() methods of Android WebView class are used to load and display web page.
You're probably looking for Chrome Custom Tabs as Morrison Chang already mentioned.
Add implementation "androidx.browser:browser:1.3.0"
to your build.gradle file.
You can open a new tab like this:
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse("https://www.example.com"));
Further examples can be found in the Implementation guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With