How can we start the gallery app in Android without telling it which file to display?
This is because I want to show images in an album/folder. However, I understand there is no such function. So, I would like to just start the gallery app.
ACTION_VIEW will always result in an "unsupported file" message, if there is no URI specified, or if MediaStore.Images.Media.EXTERNAL_CONTENT_URI is specified. This is bearable, but not desirable, as it tells the user something is wrong with my app.
ACTION_PICK works partially, but the later half is not what I want. I want the user to choose images, and see the chosen images in the gallery. The gallery should not return the URI to my app, and expect my app to display it. There is a reason for this, that is, I want the user to be able to switch from one image to another without returning to my app. The user should return only after he/she has decided not to view anymore image.
The code that I have tried :
intent = new Intent (Intent.ACTION_VIEW);
intent.setType ("image/*");
startActivity (intent);
intent = new Intent (Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivity (intent);
Any suggestion?
Related
I am implementing an android app, which will synchronize images from selected folder to server (as Google Photo). I want that user will select folder by clicking on button. I can achieve this by creating my own view. But, if implicit intent can any implicit intent action by which I can show user only images folder from device?
Try,
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 100);
change EXTERNAL_CONTENT_URI constant accordingly.
I'm develop an application in Android.
I have a ListView with some image, when I click a row I open ContextMenu and I have two Choise, eliminate the image or sharing with other application.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/*");
Uri r = Util.getImageUri(getActivity().getApplication(), image);
intent.putExtra(Intent.EXTRA_STREAM, r);
startActivity(intent);
I use this code to sharing the image, but after the first time, every time that I try to share image, the application choose always the first application with wich I send the first image.
How can I prevent it?
I want that user choose every time sharing application.
Thanks.
t
I use this code to sharing the image, but after the first time, every time that I try to share image, the application choose always the first application with wich I send the first image.
That was because you indicated, to the chooser, that you wanted to make this choice "always", instead of "just once".
I want that user choose every time sharing application
Use:
startActivity(Intent.createChooser(intent, "..."));
where "..." is your explanation for this.
In your phone go to settings-->Apps then select the app which get opens by default then there you will find an option "Open by default" open that option, in there press "Clear Defaults".
Then in your app again you will get the list of application to share with
In my android app, I create an intent to display an image in the photogallery app.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("file:///storage/sdcard0/arin/category/1/1.png"), "image/*");
context.startActivity(intent);
This opens the photo app and shows that image but only that image...
I know there are other images in the same folder. But the app wont let swipe left/right and switch images. How can I change the code so it will let me see the other pics in the same folder...
Thanks
How can I change the code so it will let me see the other pics in the same folder
Write your own "photogallery" code.
There are hundreds, perhaps thousands, of apps that are capable of responding to your Intent. None of them have to offer any means to "swipe left/right and switch images". If you want a specific set of behaviors, write them yourself. If you want the user to be able to view the image in the user's chosen app, then stick with your existing code and do not worry about the behavior of the user's chosen app.
as in the title, but i don't need to return anythimg! just open a gallery.. i tried with
Intent intent = new Intent(Intent.ACTION_VIEW, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
intent.setAction(Intent.ACTION_VIEW);
startActivity(intent);
but i have problem with HTC devices stock gallery... i only need to open a gallery on the device...stock or alternative/downloaded one.
with startActivityForResult return the selected photos, but i don't care... i need that the user can long tap to select multiple photos and than click "share via" command
Why don't you create your own Gallery using a GridView and fill the images in, you will have to implement a custom Adapter for that, have a look at Displaying images from SD Card tutorial.
I have an app which wants to view an image in the gallery app.
I use this code to view it:
File cachedImage = cache.getFile(image.getImageUrl());
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(cachedImage), "image/*");
startActivity(intent);
This works except when I click the edit setting here:
and I get the no apps can perform this action message:
Is there some way to make this work? Do I need to pass additional extras? I know the Gmail app is able to view an image attachment in the gallery and the edit function works. This is on JellyBean.
Is there some way to make this work?
Install an app that can edit pictures. Your screenshots appear to be of the Gallery app, which is presumably trying to use ACTION_EDIT to start an activity to edit the picture, and there is no such activity available.