Hi
I want to write an app to call default browser and redirect to a designated url.
Any suggestion to 1)call the default browser, 2)redirect to a designated url.
Thanks
you just want to launch an ACTION_VIEW intent with the Uri of the webpage as your data element :
Intent httpIntent = new Intent(Intent.ACTION_VIEW);
httpIntent.setData(Uri.parse("http://www.bbc.co.uk"));
startActivity(httpIntent);
To open the default browser use an Intent with the action VIEW. To tell the browser which page to load us the data-part of the Intent.
Example:
Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse("http://stackoverflow.com"));
startActivity(browse);
Since this is a basic task in Android you might want to read some basics about Intents in Android.
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