[关闭]
@act262 2017-06-28T06:06:33.000000Z 字数 494 阅读 1425

Crash

Crash


调用相机的Intent Action

  1. Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  2. // Intent.createChooser 多个匹配的相机情况下可以让用户选择用哪一个
  3. startActivityForResult(Intent.createChooser(intent, "请选择一个相机"),CODE);

出现了crash

  1. android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.hwCHOOSER (has extras) }

Intent.java

  1. // 华为ROM修改了,导致没有可以处理这个Action的问题
  2. public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER";

解决方案

  1. 直接用intent启动,不经过Chooser的包装
  2. 加上try、catch
  3. 先检查是否可以处理这个Intent然后再处理
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注