判断有处理Intent的Activity

PackageManager packageManager = getPackageManager();List<ResolveInfo> activities = packageManager.queryIntentActivities(mapIntent, 0); boolean isIntentSafe = activities.size() > 0;  // Start an activity if it's safe if (isIntentSafe) {     startActivity(mapIntent); }

將可以處理 Intent 的所有 app 列表做成下拉選擇框的形式

Intent intent = new Intent(Intent.ACTION_SEND); // Always use string resources for UI text. // This says something like "Share this photo with" String title = getResources().getString(R.string.chooser_title); // Create and start the chooser Intent chooser = Intent.createChooser(intent, title); startActivity(chooser);




更多相关文章

  1. Android中判断app是否连接网络
  2. 【开发工具】判断请求源是 手机 or PC
  3. android 屏幕方向总结
  4. android 判断3G WIFI网络
  5. Android(安卓)判断软键盘的状态(显示,隐藏)
  6. android 监听方法
  7. Android(安卓)判断是否得到 root权限
  8. android 如何判断程序是否在前台运行
  9. 根据请求头跳转判断Android&iOS

随机推荐

  1. 为数不多的人知道的AndroidStudio快捷键(
  2. Android 轻松实现语音识别
  3. 高级控件之网格视图(GridView)
  4. android studio 4.0. gradle 4.0. tinker
  5. Android(安卓)- ToDoList(fragment) 详解
  6. Android中的ellipsize
  7. Android利用系统广播---监听应用程序安装
  8. Android 中的数据库 SQLite
  9. Android(安卓)+NDK+eclipse+opengl ES2.0
  10. Android(安卓)Studio 上如何使用LogCat