开发者

Select Multiple Images in Android

开发者 https://www.devze.com 2023-03-17 12:12 出处:网络
I want to Select MultipleImages in Android. I write following code through which I can select only one image.

I want to Select Multiple Images in Android.

I write following code through which I can select only one image.

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setT开发者_C百科ype("image/*");
startActivityForResult(intent, IMAGE_PICK);

How I can achieve this ?

Thanks.


As I know standard Intent doesn't support multiple selection. You could try to extend ListView and make your own custom view to allow multiple selection.


@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)//Api Level 18
public void selectPhotos(){
    Intent intent = new Intent();
    intent.setType("image/*");
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    startActivityForResult(Intent.createChooser(intent,
            "select Multiple Images"), SELECT_PHOTOS_RESULT);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号