zoukankan      html  css  js  c++  java
  • Android调用平台功能具体技巧分享

    http://blog.csdn.net/Alinaxz/archive/2010/04/19/5503168.aspx

    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);  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 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" /> 

     

    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);

     

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

  • 相关阅读:
    42 最大子数组Ⅱ
    笔试之const问题
    笔试中sizeof求字节数的问题
    40 用栈实现队列
    38 搜索二维矩阵Ⅱ
    25.Remove Nth Node From End of List(删除链表的倒数第n个节点)
    29.最小的K个数
    28.数组中出现次数超过一半的数字
    27.字符串的排列
    26.二叉搜索树与双向链表
  • 原文地址:https://www.cnblogs.com/leaven/p/1731097.html
Copyright © 2011-2022 走看看