1
I am having a great difficulty in sharing an image of an Imageview from a button, tried several methods, but none worked.
Here’s an example of what I’m trying to share: http://www.mediafire.com/view/l0b5eobtpdbeoen/Screenshot_20170509-135902.png
I have an array with the image path 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 don’t know if the problem is my device that has Cyanogen, because I’ve seen several solutions to this problem in Stackoverflow, but none worked.
Thank you for the reply and for the beautiful tutorial, I will already test it.
– Tisco
Hello, Thiago, hello. In this line Activitycompat.requestPermissions(this, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, SOLICITAR_PERMISSAO); what would this REQUEST PERMISSION be? Because you could not solve this parameter. Thank you.
– Tisco
Thiago, I don’t know how to thank you. Perfect, it worked smoothly the code. Very good. I’m almost a week stuck with this problem and tested several methods and none had worked. Thank you for your contribution and for sharing your knowledge. Thanks a lot. Hug.
– Tisco