Android 在没有用户交互的情况下,是否可以从手机图库中获取图片?
我只想开始我的活动,检索手机图库中已有的一些图片(无需用户交互),并在我的活动中显示其中一张图片。可能吗 致以最良好的祝愿,Android 在没有用户交互的情况下,是否可以从手机图库中获取图片?,android,imageview,gallery,image,Android,Imageview,Gallery,Image,我只想开始我的活动,检索手机图库中已有的一些图片(无需用户交互),并在我的活动中显示其中一张图片。可能吗 致以最良好的祝愿, Mattias使用此代码获取画廊图像 Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, 1); protected void on
Mattias使用此代码获取画廊图像
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
startActivityForResult(photoPickerIntent, 1);
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK)
{
Uri chosenImageUri = data.getData();
Bitmap mBitmap = null;
mBitmap = Media.getBitmap(this.getContentResolver(), chosenImageUri);
}
}
这就是你要找的吗