I'm having a hard time sharing an image from an ImageView from a button, tried several methods, but none worked.
Here is an example of what I want to share: link
I have an array with the path of the images in Drawable
final int[] photos = {
R.drawable.abrir_a_boca,
R.drawable.adicao_de_quartos,
R.drawable.agarrado_firmemente,
R.drawable.agradeca,
R.drawable.alfaiate,
R.drawable.ancora,
}
compartilhar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
shareImage();
}
private void shareImage() {
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, "local do arquivo");
shareIntent.setType("image/jpeg");
startActivity(shareIntent);
}
But it never worked, now I do not know if the problem is with my device that is with Cyanogen, because I already saw several solutions to this problem in Stackoverflow, but none worked.