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);
}
精彩评论