WEB开发网
开发学院手机开发Android 开发 Android Intent 解释 阅读

Android Intent 解释

 2010-05-31 14:49:00 来源:WEB开发网   
核心提示:4. startActivity(it);5. //用呃?,要在 AndroidManifest.xml 中,Android Intent 解释(6),加上6. //< uses-permission id="android.permission.CALL_PHONE" / >传送 SM

4. startActivity(it);

5. //用呃?,要在 AndroidManifest.xml 中,加上

6. //< uses-permission id="android.permission.CALL_PHONE" / >

传送 SMS/MMS

1. // 调用短信程序

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

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

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

5. startActivity(it);

1. // 传送消息

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

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

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

5. startActivity(it);

1. // 传送 MMS

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

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

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

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

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

7. 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 2 3 4 5 6 7  下一页

Tags:Android Intent 解释

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