public static void openBrowser(Context context, String url) {
if (url != null) {
try {
if (!url.startsWith("http://")) {
url = "http://" + url;
}
Uri uri = Uri.parse(url);
Intent it = new Intent(Intent.ACTION_VIEW, uri);
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(it);
} catch (Exception e) {
Toast.makeText(context, "您未安装任何浏览器", Toast.LENGTH_SHORT).show();
}
}
}
打开浏览器
最新推荐文章于 2022-05-31 20:52:13 发布