I have picture in drawable and I want to share that one image.
Following is my code,
btnic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.defaultpicture);
Intent ppp = new Intent("android.intent.action.SEND");
ppp.setType("image/png");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, 100, bytes);
String path = MediaStore.Images.Media.insertImage(getContentResolver(),
b, "defaultpicture", null);
Uri uri = Uri.parse(path);
ppp.putExtras(Intent.EXTRA_STREAM, uri); **i am getting error here**
MainActivity.this.startActivity(Intent.createChooser(ppp, "Send picture"));
Toast.makeText(getApplicationContext(), "Picture Copied", Toast.LENGTH_SHORT).show();
}
});
where am i doing wrong?