《android常用的API接口调用》
16lz
2021-01-24
显示网页:Uriuri=Uri.parse("http://www.google.com"); Intentit=newIntent(Intent.ACTION_VIEW,uri); startActivity(it);显示地图: Uriuri=Uri.parse("geo:38.899533,-77.036476");//Uriuri=Uri.parse("geo:38.899533,-77.036476?q=street+address");//打开地图,并显示指定地址 Intentit=newIntent(Intent.Action_VIEW,uri); startActivity(it);路径规划: Uriuri=Uri.parse("http://maps.google.com/maps?f=d&saddr=startLatstartLng&daddr=endLatendLng&hl=en"); Intentit=newIntent(Intent.ACTION_VIEW,URI); startActivity(it);拨打电话: 调用拨号程序Uriuri=Uri.parse("tel:xxxxxx"); Intentit=newIntent(Intent.ACTION_DIAL,uri); startActivity(it);发送SMS/MMS: 调用发送短信的程序Intentit=newIntent(Intent.ACTION_VIEW); it.putExtra("sms_body","TheSMStext"); it.setType("vnd.android-dir/mms-sms"); startActivity(it); 发送短信Uriuri=Uri.parse("smsto:0800000123"); Intentit=newIntent(Intent.ACTION_SENDTO,uri); it.putExtra("sms_body","TheSMStext"); startActivity(it); 发送彩信Uriuri=Uri.parse("content://media/external/images/media/23"); Intentit=newIntent(Intent.ACTION_SEND); it.putExtra("sms_body","sometext"); it.putExtra(Intent.EXTRA_STREAM,uri); it.setType("image/png"); startActivity(it);发送Email Uriuri=Uri.parse("mailto:xxx@abc.com"); Intentit=newIntent(Intent.ACTION_SENDTO,uri); startActivity(it); Intentit=newIntent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_EMAIL,"me@abc.com"); it.putExtra(Intent.EXTRA_TEXT,"Theemailbodytext"); it.setType("text/plain"); startActivity(Intent.createChooser(it,"ChooseEmailClient")); Intentit=newIntent(Intent.ACTION_SEND); String[]tos={"me@abc.com"}; String[]ccs={"you@abc.com"}; it.putExtra(Intent.EXTRA_EMAIL,tos); it.putExtra(Intent.EXTRA_CC,ccs); it.putExtra(Intent.EXTRA_TEXT,"Theemailbodytext"); it.putExtra(Intent.EXTRA_SUBJECT,"Theemailsubjecttext"); it.setType("message/rfc822"); startActivity(Intent.createChooser(it,"ChooseEmailClient"));添加附件Intentit=newIntent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_SUBJECT,"Theemailsubjecttext"); it.putExtra(Intent.EXTRA_STREAM,"file:///sdcard/mysong.mp3"); sendIntent.setType("audio/mp3"); startActivity(Intent.createChooser(it,"ChooseEmailClient"));播放多媒体 Intentit=newIntent(Intent.ACTION_VIEW); Uriuri=Uri.parse("file:///sdcard/song.mp3"); it.setDataAndType(uri,"audio/mp3"); startActivity(it); Uriuri=Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI,"1"); Intentit=newIntent(Intent.ACTION_VIEW,uri); startActivity(it); Uninstall程序Uriuri=Uri.fromParts("package",strPackageName,null); Intentit=newIntent(Intent.ACTION_DELETE,uri); startActivity(it); 更多INTENT可以查看:http://wenku.baidu.com/view/ae689266783e0912a2162a46.html常用Android应用程序中的Intent动作和Uri组合及其说明动作Uri说明Intent.ACTION_VIEWgeo:latitude,longtitude打开地图应用程序并显示指定的纬度和经度Intent.ACTION_VIEWgeo:0,0?q=street+address打开地图应用程序并显示指定的地址Intent.ACTION_CALLtel:phone_number打开电话应用程序并拨打指定的电话号码Intent.ACTION_DIALtel:phone_number打开电话应用程序并拨下指定电话(但不打出)Intent.ACTION_DIALvoicemail:打开电话应用程序并拨下语音信箱号码(但不打出)Intent.ACTION_VIEWhttp://web_address打开浏览器应用程序并显示指定的URLIntent.ACTION_VIEWhttps://web_address打开浏览器应用程序并显示指定的URL
更多相关文章
- Android系统默认Home应用程序(Launcher)的启动过程源代码分析(4)
- android-Camera.AutoFocusMoveCallback
- 获得 android 通讯薄 中的内容
- 如何判断Android/IOS是否安装应用。
- (Android) ContentProvider 实例
- sharedUserId和签名Android权限
- android获取手机电话信息
- Android弹出拨号界面和拨打电话实现