I have added a share button on my layout file and made a clickListeneter for it but still don't know what to do!
@Override
protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) {
viewHolder.setDesc(model.getDesc());
viewHolder.setPostImageUrl(model.getPostImageUrl());
viewHolder.btnShare.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View view) {
.....
}
});
}
I updated my code i just need the the image URL, how to get it from recycleview
public void onClick(View view) {
String pathOfBmp = ..... ;
Uri bitmapUri = Uri.parse(pathOfBmp);
Intent sharingIntent = new
Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("image/png");
sharingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sharingIntent.putExtra(Intent.EXTRA_STREAM,bitmapUri);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
If you mean that you need to share text on Facebook, you can do the following:
This will show a dialog that allows you to select whatever app you want to share on.