Intent.ACTION_VIEW does not allow edit in gallery app - android

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.

Related

Start Android gallery app without specifying or picking image

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?

Disable screenshot

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.

Prevent auto choose which sharing application use

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

Android photoviwer VIEW intent only showing 1 image

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.

Show Intent.ACTION_PICK in landscape

I am working on an app which let users choose photo from their gallery. The problem is I need to show the gallery in landscape only. Is it possible to do it?
I use this code:
Intent galleryIntent = new Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(galleryIntent, RQC_GALLERY);
When you start any activity using explicit intent, you loose control from your application. Android finds out and application to perform that is described in intent object.
Intent object attributes details
From no where you can have control on next application regarding view.
If you want to fulfill specific requirement than make your own activity with Grid view and use image adapter to set images.
Here is one link which shows how to set images in adapter. It will help to design your code if necessary.

Categories

Resources