In my app, i am trying to implement Share button, Which when clicked should give me list of all the social media icons. I was looking at some examples, i like the way media is shared on "WhatApp", u selected the media, click on share, the a window slides up from bottom with the list of social media icons, i saw this kind of implemenatation in othe apps also, and you slide left or right to see more icons. How do i implement something like this in my app. Any examples would be appreciated. below is the screen shot of one of the apps.
Asked
Active
Viewed 2,779 times
-3
-
search on google about #Sharing Intent. – Radhey Nov 01 '17 at 04:42
2 Answers
2
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");// You Can set source type here like video, image text, etc.
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(fileUrl);
shareIntent.setFlags(FLAG_ACTIVITY_NEW_TASK);
startActivity(Intent.createChooser(shareIntent, "Share File Using!"));
}
});
here share
is my ImageView
let me know if any query

Vinesh Chauhan
- 1,288
- 11
- 27
-
thanks for replying, when i try to share the file via any media, I am getting "Couldn't attach file" – User5144 Nov 02 '17 at 01:18
-
-
-
or change line Uri.parse(fileUrl) to Uri.parse("file://"+fileUrl); – Vinesh Chauhan Nov 02 '17 at 04:31
-
@Override public void onClick(View view) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("audio/*"); Uri uri = Uri.parse("android:resource://"+getActivity().getPackageName()+"/raw/"+ selectedMediaFile); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.setFlags(FLAG_ACTIVITY_NEW_TASK); startActivity(Intent.createChooser(shareIntent, "Share Via!")); }});' – User5144 Nov 09 '17 at 12:10
0
Firstly set that image on ImageView and then use this code to share the image :-
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri bmpUri = getLocalBitmapUri(img);
if (bmpUri != null) {
// Construct a ShareIntent with link to image
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
shareIntent.setType("image/*");
// Launch sharing dialog for image
startActivity(Intent.createChooser(shareIntent, "Share Image"));
} else {
// ...sharing failed, handle error
}
}
});
"img" is my image which i want to share.

Sachin Solanki
- 79
- 2
- 15