I'm using an intent with ACTION_VIEW to view a photo on android, but it doesnt open with any of the options the gallery has when viewing other pictures (specifically share). Anyone know how to make it have those options?
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(location, mimeType);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
but just viewing in the gallery, i get all this stuff:
these issues are similar, but had no answer
Intent Action_View for image opens gallery with no delete option
Android image intent : sharing/editing options
and the interesting thing is both of those issues talk about those options ALREADY being available... so im not sure what im doing wrong.
but it doesnt open with any of the options the gallery has when viewing other pictures (specifically share)
There are ~2 billion Android devices, made up of thousands of device models. Many of those device models will ship with 1+ activities that support your Intent
structure, and many of the actual devices will have other apps that support it, installed by users. None have to offer a "share" option.
Anyone know how to make it have those options?
Strictly speaking, you can't.
Those image-viewing apps were written by developers, and those developers can do whatever they want. Perhaps there are different activities for internal use vs. ACTION_VIEW
. Perhaps it is the same activity, but they only offer those options when the activity is reached internally (vs. from outside apps via ACTION_VIEW
). Perhaps they only share certain Uri
schemes or MIME types. Perhaps they do not share images because it is Tuesday.
And, again, the behavior will be different on different devices, based on which image-viewing apps the user has and chooses to use.
If you want to have a "share" option, put it in your app. If you want that share option to be on the screen that shows the image, show the image in your app. Right now, you are delegating all of that to third-party apps, and those apps do not have to do what you want.