String url = "https://www.murait.com/"; if (url.startsWith("https://") || url.startsWith("http://")) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); }else{ Toast.makeText(mContext, "Invalid Url", Toast.LENGTH_SHORT).show(); }
You need to make sure the URL is valid or not. If the URL is invalid, the application may crash, so you should check if the URL is valid or not in this way.
Mayur Sojitra Aug 22 '19 at 2:34 am 2019-08-22 02:34
source share