I'm using the built in Android image picker as follows:
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
m_activity.startActivityForResult(photoPickerIntent, PHOTO_PICKER_ID);
Is there any way to restrict this to show only locally available files. On my device it is currently picking up Picasa thumbnails and I'd like to exclude all images that are not actually present on the device.
Adding intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); will allow for local files only. It will exclude picasa images. Hope this helps.
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(Intent.createChooser(intent,
"Complete action using"), PHOTO_PICKER_ID);
User this code to launch intent to get local image chooser.
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Complete action using"), PHOTO_PICKER_ID);
Related
I am trying to select pdf using intent and get that selected pdf file path I am not sure its right or wrong.
if not then how can I get pdf path in onActivityResult.
.
Intent intent = new Intent();
intent.setType("pdf/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select PDF"), PDF_PICKER_RESULTS);
using application/pdf line i can do this things.
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select PDF"), PDF_PICKER_RESULTS);
i am trying to open recent window which will have only image and pdf selectable
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
but in this i can select only image how i can add pdf also
you can do the following using EXTRA_MIME_TYPES (from API 19):
final String[] ACCEPT_MIME_TYPES = {
"application/pdf",
"image/*"
};
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_MIME_TYPES, ACCEPT_MIME_TYPES);
startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE_REQUEST);
UPDATE
There is also another solution but it may or may not work based on users experiences but you can try it to see if it works in your case:
intent.setType("image/*,application/pdf");
However the application that you try to invoke should also supports to MIME types as well
I have Android Xamarin application with imageview
OnClik I lunch intent to preview image
File file = new File(photoPath);
Intent intent = new Intent(Intent.ActionView);
intent.SetDataAndType(Uri.FromFile(file), "image/*");
intent.SetFlags(ActivityFlags.NoHistory);
StartActivity(intent);
from apps I choose 'Gallery'
when the image is opend there are no sharing options
when I open image from device 'Gallery' has sharing options
Image is saved to SD card before preview.
what am I doing wrong ?
solution that worked for me
Intent intent = new Intent();
intent.PutExtra(Intent.ActionView, photoPath);
intent.SetType("image/*");
StartActivity(Intent.CreateChooser(intent, "Select Picture"));
now I get my image opend in gallery and I can use sharing options too
Do it using Intent.ACTION_SEND and you'll get that sharing option.
Also try with Intent.ACTION_GET_CONTENT.
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select Picture"), 1);
I'm trying to upload an image to my application. I'm using the following lines to achieve this.
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),
PICK_IMAGE);
But when opening gallery it shows me many folders such as "Recent Images", "Documents", "Google Drive" etc.,
Here instead showing like this I would like to show only the gallery folder. Can you please help me how I can achieve this?
Try this
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),
PICK_IMAGE);
Hi there all developers:
I am using this code snippet
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);`
There exists a file manager, but its giving a messege<< No apps can perform this action. Why?? Can anyone tell me?
I have also tried without Intent.ACTION_PICK
Please put my code.
it is working.
* CODE *
Intent intent = new Intent();
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivity(intent);