In my application I allow to user to select multiple images to create pdf.
Issue is user is not able to select more than 1 images. I tried a lot but didn't get any perfect solution which can help me.
There are lot many lib available but i don't want to use it due to some reason.
I am looking for solution with native only.
Please help me.
Simple by putting extra:
int RESULT_IMAGE_MULTIPLE = 1;
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 pictures"), RESULT_IMAGE_MULTIPLE);
Related
I want to pick single and multiple images from gallery, I have tried below code
Intent intent = new Intent();
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setAction(Intent.ACTION_GET_CONTENT);
but it allows only multiple images, I can't select single one. I want pick single as well as multiple images.
There is no any default way to pick multiple images from android Gallery. You have to make your own media picker for the same. Please refer following link to get source code for picking multiple media. here
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
// intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
startActivityForResult(intent, CHOOSE_FILE_RESULT_CODE);
I am working on an application that helps the user to share his/her any accessible item(file) in the device. Codes above help user to select file(s) in the device. It is perfect! But I also want to give an opportunity to users as sharing their contacts(full contact details) with others by using my app. I tried intent.putExtras() but it supported in Build.VERSION.SDK_INT >= 19 devices (my app's min SDK is 17). It seems contact pick action requires different kind of intent type rather than "*/*". So, how merge these types of intents together? What can I do to solve the problem?
p.s I added following line to the manifest:
<uses-permission android:name="android.permission.READ_CONTACTS"/>
Brandon Zamudio marked the question as possible duplicate of this question but I can explain why it is not. In original question Hardik Trivedi wanted to pick contacts using intent. But in my case I want to give some different options to user to select. So, my problem should not be same with the original question. I did not share some pieces of my codes, but it is different one. Thanks for attention.
Actually, I wrote almost same codes approximately 2 years ago. In two days I searched for these lines. Fortunately I found them in my second Hello World! application. :)
Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // for Camera app
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE); // not necessary, but recommended
Intent contacts = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
contacts.setType(ContactsContract.Contacts.CONTENT_TYPE);
Intent chooserIntent = createChooser(intent, "Select item");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{ takePicture, contacts });
startActivityForResult(chooserIntent, CHOOSE_FILE_RESULT_CODE);
We have a website where on mobile and specifically android devices when people want to change their "avatar" image the options that show up when we click on "upload" does not have the "Gallery". Instead it has "Documents" is there a way to define what to show and what not to show?
We are using PHP if that matters at all for development.
Please see below image.
well it depends on which intent you have used for upload button, in my opinion the most appropriate intent to call when you want user to select an image would be
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
it would make the gallery and other photo handling apps visible in the chooser dialog.
for more information you can go here
Hope it helps
I am using following code to select multiple images from the gallery
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);
This works fine and I can select multiple images from the gallery. But what I want to do now is to import all the selected images in our app and populate those images in the form of a ListView. Can anyone suggest anything that might help me. Thanks in advance.
After you copy the selected images, you will have to display them on a list view.
Some code example to import/copy the selected images can be found here :
http://viralpatel.net/blogs/pick-image-from-galary-android-app/
The best documentation of Android to display images in a list view is here : http://developer.android.com/training/displaying-bitmaps/display-bitmap.html .
I have a small app where some people can have a 1:1 chat with each other. Now I want to implement a possibility to share some files (images, sounds, whatever,...).
My problem: I need a possibility to let the user choose such a file. Since I did not find some kind of "file dialogue" for Android: what is the best way to do this?
I do not need a ready-to use solution but just some hints/ideas how this could be done out of an app.
Thanks!
You can have one Button in your screen and clicking on that button let user choose a file from gallary using below code,
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);//
startActivityForResult(Intent.createChooser(intent, "Select Picture"),SELECT_IMAGE);