WEB开发网
开发学院手机开发Android 开发 Android Activity和Intent机制 阅读

Android Activity和Intent机制

 2010-08-14 00:33:00 来源:WEB开发网   
核心提示:2. Intent it = new Intent(Intent.ACTION_VIEW, uri);3. startActivity(it);4. //where startLat, startLng, endLat, endLng are a long with 6 decimals like: 50.123456

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

3. startActivity(it);

4. //where startLat, startLng, endLat, endLng are a long with 6 decimals like: 50.123456

打电话

1. //叫出拨号程序

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

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

4. startActivity(it);

1. //直接打电话出去

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

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

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 2 3 4 5 6 7 8 9 10 11  下一页

Tags:Android Activity Intent

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