1> Method
Bitmap b =BitmapFactory.decodeResource(getResources(),R.drawable.facebook_sharing_bg); Intent share1 = new Intent(Intent.ACTION_SEND); share1.setType("image/jpeg"); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); b.compress(Bitmap.CompressFormat.JPEG, 100, bytes); String path = MediaStore.Images.Media.insertImage(getContentResolver(), b, "Title", null); Uri imageUri1 = Uri.parse(path); share1.putExtra(Intent.EXTRA_STREAM, imageUri1); startActivity(Intent.createChooser(share1, "Share Image using"));
2> Method
Uri imageuri2=Uri.parse("android.resource://"+getPackageName()+"/"+R.drawable.ic_launcher);
Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/*"); share.putExtra(Intent.EXTRA_STREAM, imageuri2); startActivity(Intent.createChooser(share, "Share Image using"));
both method not work
ReplyDeleteplease add wirte permission on manifest
ReplyDeleteThis is only short code sniped
Delete