Please read my question first
I want to open a URL in my app not in phone’s browser.
You can see in Facebook or Twitter that how they open a Link in there own App.
This will redirect to my phone’s browser
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);
but I want to open URL like Facebook App.
Is there any specific API for this kind of view.
5
Answers
You can use webview in a new activity to open url. https://developer.android.com/guide/webapps/webview.html
I think you want to use Chrome Custom Tabs, check the link!
Here the basic example from the website
Following code will help you to open the url in your app:
Define above activity in manifest like this:
And Add internet permission as well:
And to call this activity just follow below code:
You can have custom ui in that case you have to define webview in xml and take the reference of layout in your webview activity.
Happy Coding!!!!
you can open url via webview within your app steps are below:
xml code below for webview;
next code for java file below:
hope this helps you out
add a webview activity/fragment, and show website in webview.