您的位置:首页 > 移动开发 > Android开发

Android常见的Intent积累

2013-10-29 15:38 429 查看
1.新建书签

Intent intent=new Intent(Intent.ACTION_VIEW);

intent.setAction("android.intent.action.INSERT");

intent.putExtra("url", "http://www.baidu.com");

intent.putExtra("title", "baidu");

intent.setType("vnd.android.cursor.dir/bookmark");

startActivity(intent);

2.新建Email

String[] reciver = new String[] { toAddress };

Intent myIntent = new Intent("com.android.email.intent.action.REPLY");

myIntent.setAction(Intent.ACTION_VIEW);

myIntent.setAction(Intent.ACTION_SEND);

myIntent.setType("plain/text");// 文字

// myIntent.setType("*/*");

// myIntent.setType("application/x-gzip");

// myIntent.setType("application/octet-stream");

myIntent.putExtra(android.content.Intent.EXTRA_EMAIL, reciver);

myIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mSubject);

myIntent.putExtra(android.content.Intent.EXTRA_TEXT, mContent);

if (isHasAcctachmentFile) {

myIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachmentFile));

}

3.新建彩信:

Intent intent = new Intent(Intent.ACTION_SEND);

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

File file = new File(Environment.getExternalStorageDirectory(), "1.jpg");

intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));

//intent.setType("application/octet-stream");

//intent.setType("plain/text");//文字

intent.setType("image/png");

//intent.putExtra(Intent.EXTRA_STREAM, uri);//uri为你的附件的uri

intent.putExtra("subject", "subString");

intent.putExtra("sms_body", "sdfsdf");

intent.putExtra("address", "12345645123");

intent.putExtra("compose_mode", false);

intent.putExtra(Intent.EXTRA_TEXT, "sdfsdf");

//intent.setType("vnd.android-dir/mms-sms");

//intent.setAction(Intent.ACTION_VIEW);

//intent.setType("image/*");//彩信附件类型

intent.setClassName("com.android.mms", "com.android.mms.ui.ComposeMessageActivity");

startActivity(intent);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: