开发学院手机开发Android 开发 Android Activity和Intent用法实例 阅读

Android Activity和Intent用法实例

 2010-09-10 00:35:00 来源:WEB开发网   
核心提示:路径规划1. Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");2. Intent it = new Intent(Intent.A

路径规划

1. Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat%20startLng&daddr=endLat%20endLng&hl=en");

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. //

传送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");

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

Tags:Android Activity Intent

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接