Android调用平台功能具体技巧分享

移动开发 Android
我们在这篇文章中为大家总结的Android调用平台功能都包括有:显示网页;显示地图;拨打电话;发送SMS/MMS等等。

Android操作系统那个可以通过调用手机平台来实现一些特定的功能,诸如网页的显示,邮件的发送等等。那么今天就为大家总结了几个Android调用平台功能的应用技巧,帮助大家增加编程经验。

Android调用平台功能之显示网页

Uri uri = Uri.parse("http://google.com");   
Intent it = new Intent(Intent.ACTION_VIEW, uri);   
startActivity(it);   
Uri uri = Uri.parse("http://google.com");   
Intent it = new Intent(Intent.ACTION_VIEW, uri);   
startActivity(it);  
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.

Android调用平台功能之显示地图

Uri uri = Uri.parse("geo:38.899533,-77.036476");   
Intent it = new Intent(Intent.ACTION_VIEW, uri);   
startActivity(it);   
//其他 geo URI 範例   
//geo:latitude,longitude   
//geo:latitude,longitude?z=zoom   
//geo:0,0?q=my+street+address   
//geo:0,0?q=business+near+city   
//google.streetview:cbll=lat,lng&cbp=1,yaw,,pitch,
zoom&
mz=mapZoom    Uri uri = Uri.parse("geo:38.899533,-77.036476");    Intent it = new Intent(Intent.ACTION_VIEW, uri);    startActivity(it);    //其他 geo URI 範例    //geo:latitude,longitude    //geo:latitude,longitude?z=zoom    //geo:0,0?q=my+street+address    //geo:0,0?q=business+near+city    //google.streetview:cbll=lat,lng&cbp=1,yaw,,pitch,
zoom&
mz=mapZoom 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.

Android调用平台功能之拨打电话

//叫出撥號程式   
Uri uri = Uri.parse("tel:0800000123");   
Intent it = new Intent(Intent.ACTION_DIAL, uri);   
startActivity(it);   
//直接打電話出去   
Uri uri = Uri.parse("tel:0800000123");   
Intent it = new Intent(Intent.ACTION_CALL, uri);   
startActivity(it);   
//用這個,要在 AndroidManifest.xml 中,加上   
//< uses-permission id="android.permission.CALL_PHONE" />   
//叫出撥號程式   
Uri uri = Uri.parse("tel:0800000123");   
Intent it = new Intent(Intent.ACTION_DIAL, uri);   
startActivity(it);   
//直接打電話出去   
Uri uri = Uri.parse("tel:0800000123");   
Intent it = new Intent(Intent.ACTION_CALL, uri);   
startActivity(it);   
//用這個,要在 AndroidManifest.xml 中,加上   
//< uses-permission id="android.permission.CALL_PHONE" />  
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.

Android调用平台功能之发送SMS/MMS

//需写号码SMS   
Intent it = new Intent(Intent.ACTION_VIEW);   
it.putExtra("sms_body", "The SMS text");   
it.setType("vnd.android-dir/mms-sms");   
startActivity(it);   
//发送SMS   
Uri uri = Uri.parse("smsto:0800000123");   
Intent it = new Intent(Intent.ACTION_SENDTO, uri);   
it.putExtra("sms_body", "The SMS text");   
startActivity(it);   
//发送MMS   
Uri uri = Uri.parse("content://media/external
/images/media/23");   
Intent it = new Intent(Intent.ACTION_SEND);    it.putExtra("sms_body", "some text");    it.putExtra(Intent.EXTRA_STREAM, uri);    it.setType("image/png");    startActivity(it);    //需写号码SMS    Intent it = new Intent(Intent.ACTION_VIEW);    it.putExtra("sms_body", "The SMS text");    it.setType("vnd.android-dir/mms-sms");    startActivity(it);    //发送SMS    Uri uri = Uri.parse("smsto:0800000123");    Intent it = new Intent(Intent.ACTION_SENDTO, uri);    it.putExtra("sms_body", "The SMS text");    startActivity(it);    //发送MMS    Uri uri = Uri.parse("content://media/external/
images/media/23");   
Intent it = new Intent(Intent.ACTION_SEND);    it.putExtra("sms_body", "some text");    it.putExtra(Intent.EXTRA_STREAM, uri);    it.setType("image/png");    startActivity(it); 
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.

Android调用平台功能的相关内容就为大家介绍到这里。

【编辑推荐】

  1. Android Java包各种功能概览
  2. Android滑动手势侦测方法介绍
  3. Android拍照实现方式概述
  4. Android数据库相关代码解读
  5. Android系统信息查看方法详解
责任编辑:曹凯 来源: javaeye.com
相关推荐

2009-12-28 10:40:13

WPF调用Winfor

2010-01-27 18:06:03

Android短信发送

2009-11-25 17:28:26

PHP对话

2010-02-25 15:25:19

WCF通道

2009-12-08 14:00:11

PHP函数microt

2010-02-23 13:03:34

WCF序列化

2009-12-01 10:50:45

PHP函数requir

2010-01-25 11:09:58

Android Htt

2009-12-30 10:25:03

Silverlight

2010-02-24 17:07:26

WCF序列化引擎

2010-03-05 16:09:44

Python中文字符

2010-01-13 16:45:44

VB.NET删除控件

2010-01-25 17:21:34

Android Act

2010-01-28 17:12:45

Android闪屏

2009-12-01 14:26:19

PHP函数ob_sta

2010-02-03 15:35:00

C++输入输出汉字

2010-01-25 18:33:35

Android键盘操作

2010-01-25 16:08:37

Android ADB

2010-01-26 13:55:57

Android分享功能

2010-03-01 17:28:25

WCF Stream对
点赞
收藏

51CTO技术栈公众号