try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link));
startActivity(myIntent);
} } catch (ActivityNotFoundException e) {
Toast.makeText(this, "No application can handle this request."
+ + " Please install a webbrowser", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
I tried to open a URL.
No activity found to handle Intent{action=android.intent.action.VIEW data =www.google.com
There was an error.
android url android-intent android-browser
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);
Do it like this. When url is used as a variable, prepare for when http:// is not attached
if (!url.startsWith("http://") && !url.startsWith("https://"))
url = "http://" + url;
It's good to do it like this.
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.