进入联系人界面
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(People.CONTENT_URI);
startActivity(intent);
查看某个联系人,当然这里是ACTION_VIEW,如果为选择并返回action改为ACTION_PICK,当然处理intent时返回需要用到startActivityforResult
Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, ID);//最后的ID参数为联系人Provider中的数据库BaseID,即哪一行
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(personUri);
startActivity(intent);
选择一个图片
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");//此处->audio/*对应选择音频 video/*对应选择视频
startActivityForResult(intent, 0);
调用Android设备的照相机,并设置拍照后存放位置
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment
.getExternalStorageDirectory().getAbsolutePath()+"/cwj", android123 + ".jpg"))); //存放位置为sdcard卡上cwj文件夹,文件名为android123.jpg格式
startActivityForResult(intent, 0);
搜索指定package name在market上,比如搜索com.android123.cwj的写法如下
Uri uri = Uri.parse("market://search?q=pname:com.android123.cwj");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
本文转载自:http://www.android123.com.cn/androidkaifa/629.html
分享到:
相关推荐
1.调用拨号程序 // 给移动客服10086拨打电话 Uri uri = Uri.parse(tel:10086); Intent intent = new Intent(Intent.ACTION_DIAL, uri); startActivity(intent); 2. 发送短信或彩信 // 给10086发送内容为...
这里总结一些重用的Intent使用,仅供参考。 下面直接给我学习的实例片段。 1,调用web浏览器 Uri myBlogUri = Uri.parse("http://kuikui.javaeye.com"); returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri); 2...
Android调用系统分享文本信息、单张图片、多个文件和指定分享到微信、QQ的实例代码: //www.jb51.net/article/112057.htm 同时分享图片和文字 private void share(String content, Uri uri){ Intent shareIntent =...
采用案例驱动模式展开讲解知识点,即介绍案例->案例涉及技术->展开知识点->总结的方式 本书作者从事多年一线开发和培训,讲解知识点力求细致,深入浅出 目 录 前言 第1章 Android操作系统概述 1 1.1 Android...
我个人在工作中常用的代码,自己边用边总结的 1.退出程序对话框提示 2.没有标题栏,没有状态栏 3. 禁止重力感应 横屏 竖屏 4.handler 5.缓冲条 6.播放器读取时间专用:把毫秒 转化成 00:00 格式显示 7. activity 间...
本文实例总结了Android编程经典代码段。分享给大家供大家参考,...2、调用浏览器 核心代码如下: Intent intent = new Intent(); intent.setAction(android.intent.action.VIEW); Uri content_url = Uri.parse(//www.
1 Android build system 4 1.1 Basic 4 1.2 Executable 6 1.3 Shared Library 9 2 Android Initialization Process 11 ...30.4 调用与被调用:我们的通信使者Intent 116 31 编译Native C的helloworld 118
使用Intent调用语音识别程序 说明 Android中主要通过RecognizerIntent来实现语音识别,其实代码比较简单,但是如果找不到语音识别设备,就会抛出异常 ActivityNotFoundException,所以我们需要捕捉这个异常。而且...
19.代码安装apk包 25 20.给模拟器打电话发短信 26 21.从google搜索内容 26 22.浏览网页 26 23.显示地图 26 25.拨打电话 27 26.调用发短信的程序 27 27.发送短信 27 28.发送彩信 28 29.发送Email 28 30....
《Android应用开发》个人总结报告 刚开始接触Android感觉到它很有意思,在界面开发上和web也可以形成了相通的架构 ,更加方便,视觉上也是非常的酷,在前期我通过的大量的Android SDK开发范例大全中的例子以及...
之前遇到各种拍照啊,获取相册图片之类,都是直接去度娘,要么之前的代码复制下,没好好总结过。 再也不要问度娘了,再也不用一堆博客里找啊找了。。。 ———————————————-我是正文的分割线——...
但是,当需要在程序中需要创建其他的activity的时候,需要显式调用这个onStart(),即startActivity(intent),这里的intent表示一个意图,就是想创建的新Activity。 还学习了android的一些基本组件,例如:id,控件...
在intent中添加了一个内容,在调用getStringExtra读取的时候,总是报错。代码如下: // back按钮 Button btnBack = (Button) findViewById(R.id.btnActivity2Back); btnBack.setOnClickListener(new ...
第1章 Android体系与系统架构 1 1.1 Google生态系统 2 1.2 Android系统架构 2 1.2.1 Linux 3 1.2.2 Dalvik与ART 3 1.2.3 Framework 3 1.2.4 Standard libraries 4 ...13.3 实战经验总结 342
关于Service的讲解网上已经很多了,这里是关于自己通过写代码Service的一点体会 还有结合其他人对Service的一点总结 Service可以理解为一个隐形的Activity 但它又与Activity有些不同,首先Service是没界面,用户看不到...
第 2 章 第二章 ................... 21 2.1. Activity 的架构设计 ....................... 21 2.1.1. 概述 ........................................ 21 2.1.2. 应用程序进程空间 ................ 21 2.1.3. ...