0

I receive an error when I press a Button.

InputStream y11 = getResources().openRawResource(R.drawable.step_000);
Bitmap b11 = BitmapFactory.decodeStream(y11);

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/png");
intent.setPackage("com.whats app.android");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, b11);
startActivity(Intent.createChooser(intent, "Share with"));
adneal
  • 30,484
  • 10
  • 122
  • 151
user3432085
  • 87
  • 1
  • 9

1 Answers1

1

You can try like this;

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.setType("image/png");

Uri uri = Uri.parse("android.resource://your package name/"+R.drawable.ic_launcher);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.putExtra(Intent.EXTRA_TEXT, "Hello, This is test Sharing");
startActivity(Intent.createChooser(shareIntent, "Send your image"));

Also look into this: Returning an Image to whatsapp

Community
  • 1
  • 1
Lokesh
  • 5,180
  • 4
  • 27
  • 42
  • 1
    This code is working but I am getting black portion in image in place of transparent portion. Please help me out. – Vikrant_Dev Jun 19 '14 at 07:53