Opening image using Gallery does not show the Share option - android

In my app, I am opening my image using this code:
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(picPathUriString)), "image/png");
startActivity(intent);
I run it on S2 and it opens the picture using the gallery as expected and showing all the capabilities of that gallery app (such as "Share" and "Send" ..etc)
On the S4, it shows the picture but the above options such as SHARE are not there. Although the Gallery on S4 has all the options if opened seperately
WHYYY? How can I make sure I get all the options?
Thanks

Try this....
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("image/png");
shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
Uri uri = Uri.parse(Uri.parse(picPathUriString));
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(shareIntent, "Share via"));

Related

Open Instagram App from Android with Gallery for selection

I am currently using this code to send an image to Instagram from Android.
It is just sending one image.
What I want to achieve is save multiple image in Gallery and instead of opening 1 image. Just open the post with the gallery option where user can select multiple images.
Intent sendIntent = new Intent();
sendIntent.setPackage("com.instagram.android");
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.setType("image/*");
Uri uri = Uri.parse(mediaPath.getString(0));
sendIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(sendIntent);
Thanks

how to share files with Share Provider in android programmatically

I want to share image on share button click, but in my code not working properly,
shareBtn.setOnClickListener(view -> {
Uri uri = Uri.parse(mImagePath);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Share Image"));
});
in my app, I fetching images from gallery, showing in app while sharing image this code working,
How should I share image from my app to another?

how to share image stored in resource folder in android?

I am trying to share GIF image that is stored in resource folder, can I share that GIF Directly or in any other
Uri uri = Uri.parse("android.resource://com.myproject/drawable/xyz.gif");
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "sharing myapp");
shareIntent.setType("image/gif");
startActivity(Intent.createChooser(shareIntent, "Share from"));
use above code but no any app found in chooser to open gif, but in my default photo gallery i can open that gif and also share.

how to send image and text and install app link in share to other apps

I am very new to this topic how to share my app along with image and text,play store link,my images and text getting from server and image should be not visible after sharing content ,please any one help me how to share this content to other apps like whats app,twitter and more ....
here below my code
File filePath = getFileStreamPath("news_image");
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(filePath));
shareIntent.setType("image/png");
shareIntent.putExtra(Intent.EXTRA_TEXT,
"Here is my IMAGE");
startActivity(Intent.createChooser(shareIntent, "Share IMAGE Using..."))
You should follow the advice from android documentation.
Snippet from the page:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);

Intent.ACTION_VIEW for Android Image

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(
Uri.parse("file://" +file.getAbsolutePath()),"image/*");
startActivity(intent);
I want to display image with share, delete and set as functionality using android intent . but my image is opening without share option......... How to show image with share options?
By Default it wont show the options with share and delete. But You can do this manually with Intent and File.
try following code for share image
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("image/*");
share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + file));
startActivity(Intent.createChooser(share, "Share image using"));

Categories

Resources