简体   繁体   中英

how to attach image from drawable folder to gmail in android?

I my application I have to attach an image from drawable folder to email client. I have no idea how to do it.

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");

Uri path = Uri.parse("android.resource://your.package.name/" + R.drawable.sample_1);    
intent.putExtra(Intent.EXTRA_STREAM, uri);
Intent sendIntent = new Intent(Intent.ACTION_SEND); 
sendIntent.putExtra("sms_body", "some text"); 
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
sendIntent.setType("image/png"); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM