QtJambiii QtJambiii
QtJambiii QtJambiii

Reputation: 274

Android intent for display url?

for some time, I have been observing that modern android apps(Telegram) use a new way to open urls in the app. By default, the apps I have made, use ACTION_VIEW and the external browser open the url. These apps now manage that intent with a kind of in-app browser witch adapts to the same style. Any idea of what its?

sample

Upvotes: 2

Views: 1549

Answers (4)

Oooha
Oooha

Reputation: 160

Those are Custom chrome tabs.In app browser.instead of using webview to open your Url, you are going to customize your chrome browser,to look alike your app.you can modify the toolbar tab color as per your app theme .You could give enter and exit animation like fragments transition.So the user wouldn't feel a big transition from your app to browser.For implementation details check this link https://developer.chrome.com/multidevice/android/customtabs

For security reasons also it could be useful,as because you are not going handle those url on you own or inside your app(there might be some security issues with JavaScript)

Upvotes: 2

Android Geek
Android Geek

Reputation: 9225

do the following:

String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

try this it helps you.

Upvotes: 1

Sagar
Sagar

Reputation: 24907

This is achieved by WebView in an Activity that displays web pages. Instead of

 Uri uri = Uri.parse("https://www.google.com/");
 Intent intent = new Intent(Intent.ACTION_VIEW, uri);
 startActivity(intent);

You will load the page by calling:

webviewObj.loadUrl("https://www.google.com/");

You can check the official document which describes the whole process. Basic Usage of WebView has been described in this blog which is easy to comprehend and implement.

Upvotes: 1

Mbuodile Obiosio
Mbuodile Obiosio

Reputation: 1543

This is done with WebView. You will find the documentation very interesting https://developer.android.com/reference/android/webkit/WebView

Upvotes: 1

Related Questions