/** * 调用第三方浏览器打开 * * @param context * @param url     要浏览的资源地址 */public static void openBrowser(Context context, String url) {    final Intent intent = new Intent();    intent.setAction(Intent.ACTION_VIEW);    intent.setData(Uri.parse(url));    // 注意此处的判断intent.resolveActivity()可以返回显示该Intent的Activity对应的组件名    // 官方解释 : Name of the component implementing an activity that can display the intent    if (intent.resolveActivity(context.getPackageManager()) != null) {        final ComponentName componentName = intent.resolveActivity(context.getPackageManager());        // 打印Log   ComponentName到底是什么        Log.d("componentName", "componentName = " + componentName.getClassName());        context.startActivity(Intent.createChooser(intent, context.getString(R.string.please_select_browser)));    } else {        Toast.makeText(context.getApplicationContext(), context.getString(R.string.please_download_browser), Toast.LENGTH_SHORT).show();    }}点击链接加入群聊【编程之美】:https://jq.qq.com/?_wv=1027&k=9qYaAE3t

更多相关文章

  1. Android(安卓)如何调用MediaPlayer播放视频[状态机]【图】
  2. android framework添加自定义服务,实现java层api调用
  3. Android平台mass storage相关代码
  4. Unity3d和iOS、Android的混合开发介绍
  5. 完美解决android Studio打开报错 https://code.google.com/p/and
  6. 使用代码为textview设置drawableLeft
  7. android横竖屏总结
  8. 对比onSaveInstanceState和onRestoreInstanceState
  9. android-2.2以下杀进程方法:restartPackage();

随机推荐

  1. Android创建和删除桌面快捷方式
  2. android 小问题记录
  3. Mac Android(安卓)FFMpeg 编译及集成
  4. android 开机自启动程序2
  5. 【Android】Android内存溢出问题---用自
  6. android activity非全屏、透明
  7. Android studio 签名 报错:Could not down
  8. android 资源获取
  9. Android drawable 目录下 创建子目录问题
  10. android json相关