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.
Related
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?
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 am using below code to view image with the help of default gallery,
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(photoURI, "image/*");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
But at the same time i want to disable screenshot when users view image using gallery. I can disable screenshot directly for my app screen but can't do when image is viewed from gallery.
Please help me.
You can't. If you need that functionality, don't use gallery and write your own display code. Although that's 99% useless- if a user really wants to screenshot his own phone, he can. Worst case he can grab a second phone and take a picture.
I have a button which opens the android gallery app. I use the code
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"content://media/internal/images/media"));
startActivity(intent);
for Android>=2.3 found here: Open Gallery App in Android
My problem: When the user opens the gallery from my app and leaves gallery (home button, share image,..), then the gallery will show up next time the user opens my app (without button click).
How can I avoid the gallery is shown in my app when opening my app? The gallery should only be shown once when the button is clicked, but not next time my app gets in front.
Your best option given what your requirements appear to be is to tell Android not to save the Gallery in your task's history. That way, when they leave the Gallery activity it will not appear in the task's history stack. Do that by setting a flag on your intent.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/internal/images/media"));
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);
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.