我想从图库中获取图像并在某些布局中设置为背景。 我做什么:如何从图库中获取图像
Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, Constants.SELECT_IMAGE);
这个意图表明我一个画廊,并允许挑选,不仅图片,但视频了。但我需要只有图像设置为背景。请给我正确的样品。
这种方式并不能帮助:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
“这种方式不利于” - 因为这是基本上是正确的答案(我会转储'createChooser()'部分),请解释“没有帮助”的含义。 – CommonsWare
我不想看视频文件 - 我只需要图片。 – Bender