WEB开发网
开发学院手机开发Android 开发 android Intent 多种用法全面介绍 阅读

android Intent 多种用法全面介绍

 2010-06-04 14:20:00 来源:WEB开发网   
核心提示:3. it.setType("vnd.android-dir/mms-sms");4. startActivity(it);发送短信1. Uri uri = Uri.parse("smsto:0800000123");2. Intent it = new Intent(Inten

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

4. startActivity(it);

发送短信

1. Uri uri = Uri.parse("smsto:0800000123");

2. Intent it = new Intent(Intent.ACTION_SENDTO, uri);

3. it.putExtra("sms_body", "The SMS text");

4. startActivity(it);

发送彩信

1. Uri uri = Uri.parse("content://media/external/images/media/23");

2. Intent it = new Intent(Intent.ACTION_SEND);

3. it.putExtra("sms_body", "some text");

4. it.putExtra(Intent.EXTRA_STREAM, uri);

5. it.setType("image/png");

6. startActivity(it);

发送Email

1. Uri uri = Uri.parse("mailto:xxx@abc.com");

2. Intent it = new Intent(Intent.ACTION_SENDTO, uri);

3. startActivity(it);

1. Intent it = new Intent(Intent.ACTION_SEND);

2. it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com");

3. it.putExtra(Intent.EXTRA_TEXT, "The email body text");

4. it.setType("text/plain");

5. startActivity(Intent.createChooser(it, "Choose Email Client"));

1. Intent it=new Intent(Intent.ACTION_SEND);

2. String[] tos={"me@abc.com"};

3. String[] ccs={"you@abc.com"};

4. it.putExtra(Intent.EXTRA_EMAIL, tos);

5. it.putExtra(Intent.EXTRA_CC, ccs);

6. it.putExtra(Intent.EXTRA_TEXT, "The email body text");

7. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

8. it.setType("message/rfc822");

9. startActivity(Intent.createChooser(it, "Choose Email Client"));

添加附件

1. Intent it = new Intent(Intent.ACTION_SEND);

2. it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text");

3. it.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/mysong.mp3");

4. sendIntent.setType("audio/mp3");

5. startActivity(Intent.createChooser(it, "Choose Email Client"));

上一页  1 2 3 4 5 6  下一页

Tags:android Intent 多种

编辑录入:coldstar [复制链接] [打 印]
赞助商链接