How can I upload multiple images from gallery?











up vote
0
down vote

favorite












I can choose single image from gallery but can't choose multiple images.

I google information about that and found add EXTRA_ALLOW_MULTIPLE to putExtra, but it doesn't work for me. Can anyone help me?

My problem is file upload on webview. I am targeting at os6, os7 or os8.



my code :



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
i.setAction(Intent.ACTION_PICK);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}


update
Thanks everyone. Finally, I can choose both single image or multiple images from gallery. This is my solution, I need to clean up unnecessary code though.



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setType("image/*");
i.addCategory(Intent.CATEGORY_OPENABLE);
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}

uploadMessage = filePathCallback;

Intent intent = fileChooserParams.createIntent();
intent.setType("image/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
try {
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e) {
uploadMessage = null;
Toast.makeText(MainActivity.this.getApplicationContext(), "can't choose files", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
});


@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode == REQUEST_SELECT_FILE) {
if (uploadMessage == null) return;

ClipData clipData = intent.getClipData();
if (clipData != null && clipData.getItemCount() > 0) {
Uri results = new Uri[clipData.getItemCount()];
for (int i = 0; i < clipData.getItemCount(); i++) {
ClipData.Item item = clipData.getItemAt(i);
results[i] = item.getUri();
}

uploadMessage.onReceiveValue(results);
uploadMessage = null;
} else {
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
uploadMessage = null;
}

}
} else if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage) return;

Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else {
Toast.makeText(MainActivity.this.getApplicationContext(), "fail to upload files", Toast.LENGTH_LONG).show();
}
}









share|improve this question
























  • github.com/siralam/BSImagePicker
    – Vivek Mishra
    Nov 19 at 11:05










  • This question has been asked before. You can have a look at this solution.
    – Razor
    Nov 19 at 11:11










  • Delete i.setAction(Intent.ACTION_PICK); and hope for the best.
    – CommonsWare
    Nov 19 at 12:04















up vote
0
down vote

favorite












I can choose single image from gallery but can't choose multiple images.

I google information about that and found add EXTRA_ALLOW_MULTIPLE to putExtra, but it doesn't work for me. Can anyone help me?

My problem is file upload on webview. I am targeting at os6, os7 or os8.



my code :



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
i.setAction(Intent.ACTION_PICK);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}


update
Thanks everyone. Finally, I can choose both single image or multiple images from gallery. This is my solution, I need to clean up unnecessary code though.



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setType("image/*");
i.addCategory(Intent.CATEGORY_OPENABLE);
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}

uploadMessage = filePathCallback;

Intent intent = fileChooserParams.createIntent();
intent.setType("image/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
try {
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e) {
uploadMessage = null;
Toast.makeText(MainActivity.this.getApplicationContext(), "can't choose files", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
});


@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode == REQUEST_SELECT_FILE) {
if (uploadMessage == null) return;

ClipData clipData = intent.getClipData();
if (clipData != null && clipData.getItemCount() > 0) {
Uri results = new Uri[clipData.getItemCount()];
for (int i = 0; i < clipData.getItemCount(); i++) {
ClipData.Item item = clipData.getItemAt(i);
results[i] = item.getUri();
}

uploadMessage.onReceiveValue(results);
uploadMessage = null;
} else {
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
uploadMessage = null;
}

}
} else if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage) return;

Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else {
Toast.makeText(MainActivity.this.getApplicationContext(), "fail to upload files", Toast.LENGTH_LONG).show();
}
}









share|improve this question
























  • github.com/siralam/BSImagePicker
    – Vivek Mishra
    Nov 19 at 11:05










  • This question has been asked before. You can have a look at this solution.
    – Razor
    Nov 19 at 11:11










  • Delete i.setAction(Intent.ACTION_PICK); and hope for the best.
    – CommonsWare
    Nov 19 at 12:04













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I can choose single image from gallery but can't choose multiple images.

I google information about that and found add EXTRA_ALLOW_MULTIPLE to putExtra, but it doesn't work for me. Can anyone help me?

My problem is file upload on webview. I am targeting at os6, os7 or os8.



my code :



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
i.setAction(Intent.ACTION_PICK);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}


update
Thanks everyone. Finally, I can choose both single image or multiple images from gallery. This is my solution, I need to clean up unnecessary code though.



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setType("image/*");
i.addCategory(Intent.CATEGORY_OPENABLE);
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}

uploadMessage = filePathCallback;

Intent intent = fileChooserParams.createIntent();
intent.setType("image/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
try {
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e) {
uploadMessage = null;
Toast.makeText(MainActivity.this.getApplicationContext(), "can't choose files", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
});


@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode == REQUEST_SELECT_FILE) {
if (uploadMessage == null) return;

ClipData clipData = intent.getClipData();
if (clipData != null && clipData.getItemCount() > 0) {
Uri results = new Uri[clipData.getItemCount()];
for (int i = 0; i < clipData.getItemCount(); i++) {
ClipData.Item item = clipData.getItemAt(i);
results[i] = item.getUri();
}

uploadMessage.onReceiveValue(results);
uploadMessage = null;
} else {
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
uploadMessage = null;
}

}
} else if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage) return;

Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else {
Toast.makeText(MainActivity.this.getApplicationContext(), "fail to upload files", Toast.LENGTH_LONG).show();
}
}









share|improve this question















I can choose single image from gallery but can't choose multiple images.

I google information about that and found add EXTRA_ALLOW_MULTIPLE to putExtra, but it doesn't work for me. Can anyone help me?

My problem is file upload on webview. I am targeting at os6, os7 or os8.



my code :



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.addCategory(Intent.CATEGORY_OPENABLE);
i.setType("image/*");
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
i.setAction(Intent.ACTION_PICK);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}


update
Thanks everyone. Finally, I can choose both single image or multiple images from gallery. This is my solution, I need to clean up unnecessary code though.



    mWebview.setWebChromeClient(new WebChromeClient() {
protected void openFileChooser(ValueCallback uploadMsg, String acceptType) {
mUploadMessage = uploadMsg;
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
i.setType("image/*");
i.addCategory(Intent.CATEGORY_OPENABLE);
i.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE);
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public boolean onShowFileChooser(WebView mWebView, ValueCallback<Uri> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
if (uploadMessage != null) {
uploadMessage.onReceiveValue(null);
uploadMessage = null;
}

uploadMessage = filePathCallback;

Intent intent = fileChooserParams.createIntent();
intent.setType("image/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
try {
startActivityForResult(intent, REQUEST_SELECT_FILE);
} catch (ActivityNotFoundException e) {
uploadMessage = null;
Toast.makeText(MainActivity.this.getApplicationContext(), "can't choose files", Toast.LENGTH_LONG).show();
return false;
}
return true;
}
});


@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (requestCode == REQUEST_SELECT_FILE) {
if (uploadMessage == null) return;

ClipData clipData = intent.getClipData();
if (clipData != null && clipData.getItemCount() > 0) {
Uri results = new Uri[clipData.getItemCount()];
for (int i = 0; i < clipData.getItemCount(); i++) {
ClipData.Item item = clipData.getItemAt(i);
results[i] = item.getUri();
}

uploadMessage.onReceiveValue(results);
uploadMessage = null;
} else {
uploadMessage.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
uploadMessage = null;
}

}
} else if (requestCode == FILECHOOSER_RESULTCODE) {
if (null == mUploadMessage) return;

Uri result = intent == null || resultCode != RESULT_OK ? null : intent.getData();
mUploadMessage.onReceiveValue(result);
mUploadMessage = null;
} else {
Toast.makeText(MainActivity.this.getApplicationContext(), "fail to upload files", Toast.LENGTH_LONG).show();
}
}






android android-intent






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked Nov 19 at 11:03









Ken

295




295












  • github.com/siralam/BSImagePicker
    – Vivek Mishra
    Nov 19 at 11:05










  • This question has been asked before. You can have a look at this solution.
    – Razor
    Nov 19 at 11:11










  • Delete i.setAction(Intent.ACTION_PICK); and hope for the best.
    – CommonsWare
    Nov 19 at 12:04


















  • github.com/siralam/BSImagePicker
    – Vivek Mishra
    Nov 19 at 11:05










  • This question has been asked before. You can have a look at this solution.
    – Razor
    Nov 19 at 11:11










  • Delete i.setAction(Intent.ACTION_PICK); and hope for the best.
    – CommonsWare
    Nov 19 at 12:04
















github.com/siralam/BSImagePicker
– Vivek Mishra
Nov 19 at 11:05




github.com/siralam/BSImagePicker
– Vivek Mishra
Nov 19 at 11:05












This question has been asked before. You can have a look at this solution.
– Razor
Nov 19 at 11:11




This question has been asked before. You can have a look at this solution.
– Razor
Nov 19 at 11:11












Delete i.setAction(Intent.ACTION_PICK); and hope for the best.
– CommonsWare
Nov 19 at 12:04




Delete i.setAction(Intent.ACTION_PICK); and hope for the best.
– CommonsWare
Nov 19 at 12:04












3 Answers
3






active

oldest

votes

















up vote
0
down vote













Intent intent = new Intent();
intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image*//*");
String extraMimeTypes = {"image/*"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeTypes);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(intent, REQUEST_CODE_GALLERY);


Try this. Working in all versions.






share|improve this answer





















  • Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
    – CommonsWare
    Nov 19 at 12:02










  • @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
    – Jayanth vn
    yesterday


















up vote
0
down vote













use image picker



 ImagePicker.create(UploadPhotosActivity.this)
.showCamera(false)
.limit(2) // set your limit here
.imageTitle(getString(R.string.select_image))
.folderTitle(getString(R.string.folder))
.theme(R.style.ImagePickerTheme)
.start(RC_CODE_PICKER);


add these to your dependency



compile 'com.github.esafirm.android-image-picker:imagepicker:1.5.0'
compile 'com.github.esafirm.android-image-picker:rximagepicker:1.5.0'





share|improve this answer























  • There is nothing named ImagePicker in the Android SDK.
    – CommonsWare
    Nov 19 at 12:02


















up vote
0
down vote













Edit your code i.e. Remove:



i.setAction(Intent.ACTION_PICK);


Follow below code :



Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373226%2fhow-can-i-upload-multiple-images-from-gallery%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image*//*");
    String extraMimeTypes = {"image/*"};
    intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeTypes);
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    startActivityForResult(intent, REQUEST_CODE_GALLERY);


    Try this. Working in all versions.






    share|improve this answer





















    • Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
      – CommonsWare
      Nov 19 at 12:02










    • @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
      – Jayanth vn
      yesterday















    up vote
    0
    down vote













    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image*//*");
    String extraMimeTypes = {"image/*"};
    intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeTypes);
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    startActivityForResult(intent, REQUEST_CODE_GALLERY);


    Try this. Working in all versions.






    share|improve this answer





















    • Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
      – CommonsWare
      Nov 19 at 12:02










    • @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
      – Jayanth vn
      yesterday













    up vote
    0
    down vote










    up vote
    0
    down vote









    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image*//*");
    String extraMimeTypes = {"image/*"};
    intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeTypes);
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    startActivityForResult(intent, REQUEST_CODE_GALLERY);


    Try this. Working in all versions.






    share|improve this answer












    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setType("image*//*");
    String extraMimeTypes = {"image/*"};
    intent.putExtra(Intent.EXTRA_MIME_TYPES, extraMimeTypes);
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    startActivityForResult(intent, REQUEST_CODE_GALLERY);


    Try this. Working in all versions.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 19 at 11:33









    Jayanth vn

    4714




    4714












    • Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
      – CommonsWare
      Nov 19 at 12:02










    • @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
      – Jayanth vn
      yesterday


















    • Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
      – CommonsWare
      Nov 19 at 12:02










    • @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
      – Jayanth vn
      yesterday
















    Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
    – CommonsWare
    Nov 19 at 12:02




    Since ACTION_OPEN_DOCUMENT was only added in API Level 19, and since image*//* is not a valid MIME type, this code definitely does not work "in all versions".
    – CommonsWare
    Nov 19 at 12:02












    @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
    – Jayanth vn
    yesterday




    @CommonsWare I mean whatever versions he required. He mentioned " I am targeting at os6, os7 or os8".
    – Jayanth vn
    yesterday












    up vote
    0
    down vote













    use image picker



     ImagePicker.create(UploadPhotosActivity.this)
    .showCamera(false)
    .limit(2) // set your limit here
    .imageTitle(getString(R.string.select_image))
    .folderTitle(getString(R.string.folder))
    .theme(R.style.ImagePickerTheme)
    .start(RC_CODE_PICKER);


    add these to your dependency



    compile 'com.github.esafirm.android-image-picker:imagepicker:1.5.0'
    compile 'com.github.esafirm.android-image-picker:rximagepicker:1.5.0'





    share|improve this answer























    • There is nothing named ImagePicker in the Android SDK.
      – CommonsWare
      Nov 19 at 12:02















    up vote
    0
    down vote













    use image picker



     ImagePicker.create(UploadPhotosActivity.this)
    .showCamera(false)
    .limit(2) // set your limit here
    .imageTitle(getString(R.string.select_image))
    .folderTitle(getString(R.string.folder))
    .theme(R.style.ImagePickerTheme)
    .start(RC_CODE_PICKER);


    add these to your dependency



    compile 'com.github.esafirm.android-image-picker:imagepicker:1.5.0'
    compile 'com.github.esafirm.android-image-picker:rximagepicker:1.5.0'





    share|improve this answer























    • There is nothing named ImagePicker in the Android SDK.
      – CommonsWare
      Nov 19 at 12:02













    up vote
    0
    down vote










    up vote
    0
    down vote









    use image picker



     ImagePicker.create(UploadPhotosActivity.this)
    .showCamera(false)
    .limit(2) // set your limit here
    .imageTitle(getString(R.string.select_image))
    .folderTitle(getString(R.string.folder))
    .theme(R.style.ImagePickerTheme)
    .start(RC_CODE_PICKER);


    add these to your dependency



    compile 'com.github.esafirm.android-image-picker:imagepicker:1.5.0'
    compile 'com.github.esafirm.android-image-picker:rximagepicker:1.5.0'





    share|improve this answer














    use image picker



     ImagePicker.create(UploadPhotosActivity.this)
    .showCamera(false)
    .limit(2) // set your limit here
    .imageTitle(getString(R.string.select_image))
    .folderTitle(getString(R.string.folder))
    .theme(R.style.ImagePickerTheme)
    .start(RC_CODE_PICKER);


    add these to your dependency



    compile 'com.github.esafirm.android-image-picker:imagepicker:1.5.0'
    compile 'com.github.esafirm.android-image-picker:rximagepicker:1.5.0'






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 19 at 12:07

























    answered Nov 19 at 11:26









    Kevin Kurien

    3949




    3949












    • There is nothing named ImagePicker in the Android SDK.
      – CommonsWare
      Nov 19 at 12:02


















    • There is nothing named ImagePicker in the Android SDK.
      – CommonsWare
      Nov 19 at 12:02
















    There is nothing named ImagePicker in the Android SDK.
    – CommonsWare
    Nov 19 at 12:02




    There is nothing named ImagePicker in the Android SDK.
    – CommonsWare
    Nov 19 at 12:02










    up vote
    0
    down vote













    Edit your code i.e. Remove:



    i.setAction(Intent.ACTION_PICK);


    Follow below code :



    Intent intent = new Intent();
    intent.setType("image/*");
    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);





    share|improve this answer

























      up vote
      0
      down vote













      Edit your code i.e. Remove:



      i.setAction(Intent.ACTION_PICK);


      Follow below code :



      Intent intent = new Intent();
      intent.setType("image/*");
      intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
      intent.setAction(Intent.ACTION_GET_CONTENT);
      startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Edit your code i.e. Remove:



        i.setAction(Intent.ACTION_PICK);


        Follow below code :



        Intent intent = new Intent();
        intent.setType("image/*");
        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);





        share|improve this answer












        Edit your code i.e. Remove:



        i.setAction(Intent.ACTION_PICK);


        Follow below code :



        Intent intent = new Intent();
        intent.setType("image/*");
        intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent,"Select Picture"), 1);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 at 12:39









        Rishav Singla

        34228




        34228






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373226%2fhow-can-i-upload-multiple-images-from-gallery%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            How to fix TextFormField cause rebuild widget in Flutter