我正在开发具有多个图像视图的应用程序,当我单击图像时,我希望它通过 android 默认图库图像选择器打开。我试过这样:
String str = "android.resource://" + getPackageName() +"/"+R.drawable.wall1;
Uri path = Uri.parse(str);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(path, "image/*");
startActivity(intent);
但它不起作用,我得到异常: android.content.ActivityNotFoundException: 没有找到处理 Intent { act=android.intent.action.VIEW dat=android.resource://com.example.demo/2130837505 typ= 的活动图片/* }