Android 使用MMS彩信或者Gmail发送图片

Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_STREAM,imageUri);//这里必须是图片的uri
i.setType("image/jpeg");
startActivity(Intent.createChooser(i,TITLE_TIP));//TITLE_TIP是弹出的选择程序处理的文字标题

==================================================
Android 使用短信或者Gmail发送文字

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT,SOMETHING_TITLE);//Gmail的邮件主题,可选
intent.putExtra(Intent.EXTRA_TEXT,SOMETHING_TEXT_BODY);//文本内容
startActivity(Intent.createChooser(intent,TITLE_TIP));//弹出的选择程序处理的文字标题

这样所有intent-filter的action设置为android.intent.action.SEND的Activity都将作为被选择程序出现在列表中。

posted on 2012-02-13 16:50  Lee_Alvin  阅读(193)  评论(0编辑  收藏  举报