How to Share Image and Text

Asked

Viewed 807 times

0

In my application I have a share button, until then it only shares an image I was wanting it to share a text too , a reference of my application the name

Code I use to share image

int drawableId = getResources().getIdentifier(listenerItem.nome_foto, "drawable", getPackageName());
            Drawable drawable = getResources().getDrawable(drawableId);
            Bitmap bitmap = getBitmap(drawable);
            Uri imageUri = getImageUri(this, bitmap);

            Intent sendIntent = new Intent();
            sendIntent.setAction(Intent.ACTION_SEND);
            sendIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
            sendIntent.setType("image/jpg");
            startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.compartilhar)));
  • I wonder if this share code Image works currently, I’m facing problems to share the image

  • It does work...

1 answer

1


Try changing the MIME for:

sendIntent.setType("*/*");

And add the text like this:

sendIntent.putExtra(Intent.EXTRA_TEXT, "Lorem ipsum dolor...");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.