2

我目前有以下内容:

Intent intent = new Intent(Intent.ACTION_VIEW, android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
startActivity(intent);

它在大多数情况下都能完美运行,但至少对于 Android 2.3.4 设备会产生以下异常:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://media/external/video/media }

任何人都可以分享在 Android 设备上打开图库的通用方法吗?

4

1 回答 1

1

如果您正在谈论打开图片库,可以使用以下内容从 SD 卡中选择图像:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);//only local images
startActivityForResult(intent, IMAGE_PICK_ADD);
于 2013-03-27T19:59:04.983 回答