整理下 Intent 中文API
来源:互联网 发布:c语言 面向过程 编辑:程序博客网 时间:2024/05/22 01:51
常见的Activity Action Intent常量ACTION_MAINandroid.intent.action.MAIN应用程序入口ACTION_VIEWandroid.intent.action.VIEW显示数据给用户ACTION_ATTACH_DATAandroid.intent.action.ATTACH_DATA指明附加信息给其他地方的一些数据ACTION_EDITandroid.intent.action.EDIT显示可编辑的数据ACTION_PICKandroid.intent.action.PICK选择数据ACTION_CHOOSERandroid.intent.action.CHOOSER显示一个Activity选择器ACTION_GET_CONTENTandroid.intent.action.GET_CONTENT获得内容ACTION_DIALandroid.intent.action.GET_CONTENT显示打电话面板ACITON_CALLandroid.intent.action.DIAL直接打电话ACTION_SENDandroid.intent.action.SEND直接发短信ACTION_SENDTOandroid.intent.action.SENDTO选择发短信ACTION_ANSWERandroid.intent.action.ANSWER应答电话ACTION_INSERTandroid.intent.action.INSERT插入数据ACTION_DELETEandroid.intent.action.DELETE删除数据ACTION_RUNandroid.intent.action.RUN运行数据ACTION_SYNCandroid.intent.action.SYNC同步数据ACTION_PICK_ACTIVITYandroid.intent.action.PICK_ACTIVITY选择ActivityACTION_SEARCHandroid.intent.action.SEARCH搜索ACTION_WEB_SEARCHandroid.intent.action.WEB_SEARCHWeb搜索ACTION_FACTORY_TESTandroid.intent.action.FACTORY_TEST工厂测试入口点 常见的BroadcastIntent Action常量BroadcastIntent Action字符串常量描述ACTION_TIME_TICK系统时间每过一分钟发出的广播ACTION_TIME_CHANGED系统时间通过设置发生了变化ACTION_TIMEZONE_CHANGED时区改变ACTION_BOOT_COMPLETED系统启动完毕ACTION_PACKAGE_ADDED新的应用程序apk包安装完毕ACTION_PACKAGE_CHANGED现有应用程序apk包改变ACTION_PACKAGE_REMOVED现有应用程序apk包被删除ACTION_UID_REMOVED用户id被删除
显示网页:
Uri uri = Uri.parse("http://www.google.com"); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it);显示地图:
Uri uri = Uri.parse("geo:38.899533,-77.036476"); Intent it = new Intent(Intent.Action_VIEW,uri); startActivity(it);路径规划:
Uri uri = Uri.parse("http://maps.google.com/maps?f=d&saddr=startLat startLng&daddr=endLat endLng&hl=en"); Intent it = new Intent(Intent.ACTION_VIEW,URI); startActivity(it);调用拨号程序:
Uri uri = Uri.parse("tel:xxxxxx"); Intent it = new Intent(Intent.ACTION_DIAL, uri); startActivity(it);拨打电话:
要使用这个必须在配置文件中加入<uses-permission id="android.permission.CALL_PHONE" />
Uri uri = Uri.parse("tel.xxxxxx"); Intent it =new Intent(Intent.ACTION_CALL,uri);发送SMS/MMS:
Intent it = new Intent(Intent.ACTION_VIEW); it.putExtra("sms_body", "The SMS text"); it.setType("vnd.android-dir/mms-sms"); startActivity(it);发送短信:
Uri uri = Uri.parse("smsto:0800000123"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); it.putExtra("sms_body", "The SMS text"); startActivity(it);发送彩信:
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);发送Email:
Uri uri = Uri.parse("mailto:xxx@abc.com"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); startActivity(it);或者:
Intent it = new Intent(Intent.ACTION_SEND); it.putExtra(Intent.EXTRA_EMAIL, "me@abc.com"); it.putExtra(Intent.EXTRA_TEXT, "The email body text"); it.setType("text/plain"); startActivity(Intent.createChooser(it, "Choose Email Client"));或者:
Intent it=new Intent(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, "The email body text"); it.putExtra(Intent.EXTRA_SUBJECT, "The email subject text"); it.setType("message/rfc822"); startActivity(Intent.createChooser(it, "Choose Email Client"));播放多媒体:
Intent it = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse("file:///sdcard/song.mp3"); it.setDataAndType(uri, "audio/mp3"); startActivity(it);或者:
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);卸载程序:
Uri uri = Uri.fromParts("package", strPackageName, null); Intent it = new Intent(Intent.ACTION_DELETE, uri); startActivity(it);安装程序:
Uri installUri = Uri.fromParts("package", "xxx", null); returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);搜索应用:
Uri uri = Uri.parse("market://search?q=pname:pkg_name"); Intent it = new Intent(Intent.ACTION_VIEW, uri); startActivity(it);
0 0
- 整理下 Intent 中文API
- 整理下 Intent 中文API
- 整理下 Intent 中文API
- 整理下 Intent 中文API
- 整理下 Intent 中文API
- 整理下 Intent 中文API 19
- Intent 中文API
- 整理下 Intent
- Bootstrap FileInput中文API整理
- Bootstrap FileInput中文API整理
- Bootstrap FileInput中文API整理
- IScroll5中文API整理,用法与参考
- IScroll5中文API整理,用法与参考
- jQery.form.js中文API【整理】
- intent中文
- extjs4.0中文API整理01——Application
- extjs4.0中文API整理02——Container
- Android学习整理-Intent整理
- 读《当我谈跑步时,我谈些什么》后感
- vs2012 c# winform installshield 打包
- sklearn 常用api(二)
- stm32f432位计数器计数
- 入门VR游戏开发者在Unreal Engine 4上开始VR设计所需要知道的
- 整理下 Intent 中文API
- UI基础__类似QQ好友列表制作
- 模拟语音加密的置乱技术简介
- lsof 查看打开文件状态
- iOS笔记
- 深度学习文献阅读笔记(6)
- 做网站:myeclipse+tomcat+mysql环境搭建
- C语言实现封装、继承和多态
- Sumsets(递推)