开发者

Select Multiple Images in Android

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜