android基础---->摄像头与相册的调用
很多应用程序都可能会使用到调用摄像头拍照和从相册选取图片的功能,今天我们开始android中摄像头与相册调用的学习。
目录导航
调用摄像头拍照
大致流程:调用相机拍照,然后剪辑,之后再在imageView中显示。项目结构如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAASEAAAD8CAIAAAC3qIUJAAAWc0lEQVR4nO2dy28cR37H56/ILRcfcsolhwRuIBEErY0IMcSTLru+BIugD9ZJMEisrES0gcDe9a4bRhYQd20HNjaIFYOahzLUSJpw/dAQlgXRoinJlDl6EIjY5AIrm9SIQ3uyEjqHnu7+1aMf09M1/fp+MIA4PVX9IOujqu7p+nbFGpvfn/4p97p/7dz4qwWgGFTGX4XoWGKadQ2tUqnorXHXoBndBPYGgDiockz64ip2DS2k+WfesfBDSK4WyClDxxYWFqoyms1m6CpiO9bSw5p/5h0LP4TkaoGcMnTMNE2pY6Zphq5C6k9omZZe8dBbjg02Tvsjjg3LDz/xag8XOC61nLVwy7tODdK06S64HjvtP7C8vVA4BNmOseX0lrQWKDLeWLHdbnOCtdvtKKtIyDFmwbD1uY7ZHwqCyQ2ljXzomKaxxcWVMMsjlJfZEr5jcKyEeI71er1areYKVqvVer1elFVEcWzz1iebtz7hFvoNmbzlQ8d0atiwkdqt0z2zGTZlpjchy2nHoxldi5XW7wMy0JRulDsEaRnZQWKsWCqYax5LS0uuY51OJ+IqAhw7fuYK96Kfsk2N64mIY+x/+ZIeS29x513eO3a5u0XuNI2Xyae80EkxpX3KkH5LWC0oA4xjg8GgXq/bndhgMIi4ikQco5fahH7MoJ2U/CpGVyxChmpi46Z9DvMuyDFRC9ExuTquaOI2QNHhr92vrKxUq9XV1dXoqxjPsWHLEzoB6liLVcj/zM1vuaQDCT4fCy0vXOLwO6UMXobzsRIg+X5scXFxpFX4XanfvPVJsGOeGLSBaobB92NUItEoxiWDuxzo65jFNn/huqL4RtwofwiyMnQj4rgYjpUAhd9BhzuWILifA2SVBBwLAI4BoNaxyQHHQFYp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jxFllkhpocBlsw5pjwzx5tUSVJyJBE3wY7RqZnOUtxYD2RkzrHJZeawSghdUKBj/JPQ3YwBJgAOACtrjk0kM2coWdfQSH8mRtyEOearkm0rTANDsuLYBDNzLKtraJquO4r5RNxQx6iMXsQiOTMbljRk522g5KTv2MQzcywhFUoaceNdV3Q/Jp/Kr28gBBiIpO9YbNRn5gCQADl2DIBcAMcAUAscA0AtcAwAtcAxANQCxwBQCxwDQC1wDAC1wDEA1PL/ssqSSPaXHgQAAAAASUVORK5CYII=" alt="" />
一、 一些初始化的代码:
public static final int TAKE_PHOTO = 1;
public static final int CROP_PHOTO = 2;
public static final int CHOOSE_PHOTO = 3;
private ImageView picture;
private Uri imageUri; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
picture = (ImageView) findViewById(R.id.picture);
}
二、 创建文件:
// 创建File对象,用于存储拍照后的图片
private File createImageFile(String fileName) {
File outputImage = new File(Environment.getExternalStorageDirectory(), fileName);
try {
if (outputImage.exists()) {
outputImage.delete();
}
outputImage.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
return outputImage;
}
三、 调用系统相机拍照,
// 调用系统相机拍照,并创建一张jpg文件
public void takePhone(View view) {
imageUri = Uri.fromFile(createImageFile("takephone.jpg"));
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, TAKE_PHOTO); // 启动相机程序
}
四、 onActivityResult方法:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case TAKE_PHOTO:
phoneTake(resultCode);
break;
case CROP_PHOTO:
phoneCrop(resultCode);
break;
case CHOOSE_PHOTO:
phoneChoose(resultCode, data);
break;
default:
break;
}
}
五、 phoneTake方法:
// 拍照的回调
private void phoneTake(int resultCode) {
if (resultCode == RESULT_OK) {
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(imageUri, "image/*");
intent.putExtra("scale", true);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, CROP_PHOTO); // 启动裁剪程序
}
}
六、 phoneCrop方法,裁剪的回调
// 裁剪的回调
private void phoneCrop(int resultCode) {
if (resultCode == RESULT_OK) {
try {
BufferedInputStream inputStream = new BufferedInputStream(getContentResolver().openInputStream(imageUri));
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
picture.setImageBitmap(bitmap); // 将裁剪后的照片显示出来
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
七、 声明权限:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
从相册中选择照片
一、 从相册中选择照片:
// 从相册中选择照片:
public void choosePhone(View view) {
imageUri = Uri.fromFile(createImageFile("choosephone.jpg"));
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra("crop", true);
intent.putExtra("scale", true);
startActivityForResult(intent, CHOOSE_PHOTO);
}
二、 从相册中选取图片,再显示
// 从相册中选取图片,再显示
private void phoneChoose(int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
ContentResolver resolver = getContentResolver();
Uri originalUri = data.getData();
try {
Bitmap photo = MediaStore.Images.Media.getBitmap(resolver, originalUri);
if (photo != null) {
picture.setImageBitmap(photo);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
友情链接
android基础---->摄像头与相册的调用的更多相关文章
- 使用HTML5+调用手机摄像头和相册
前言:前端时间使用HTML5做了一个WEB端APP,其中用到了H5页面调用手机摄像头的功能,当时也是花了不少时间去研究.最终是采用了HTML5plus(HTML5+)的方式完成了该功能,现将具体方法简 ...
- Android基础总结(10)——手机多媒体的运用:通知、短信、相机、视频播放
Android提供了一系列的API,是我们可以在程序中调用很多手机的多媒体资源,从而编写出更加丰富的应用程序. 1.通知的使用 通知(Notification)是Android中比较有特色的一个功能, ...
- iOS摄像头和相册-UIImagePickerController-浅析(转)
iOS摄像头和相册-UIImagePickerController-浅析(转) 转自: http://blog.sina.com.cn/s/blog_7b9d64af0101cfd9.html 在一些 ...
- Android基础新手教程——4.1.1 Activity初学乍练
Android基础新手教程--4.1.1 Activity初学乍练 标签(空格分隔): Android基础新手教程 本节引言: 本节開始解说Android的四大组件之中的一个的Activity(活动) ...
- Android基础测试题(二)
今天给大家带来的是Android基础测试题(二) 题目要求: 定义一个5位长度的整型数组并初始化,然后构建方法根据用户传入的数字判断是否存在数组中,如果存在,返回所在位置,如果不存在,返回-1 首先第 ...
- html5调取手机摄像头或相册
html5调用手机摄像头或者相册 由于input的type=file 格式的文件的界面并不是我们所希望的界面,所以在此我隐藏input,自定义样式,这个样式就在<a>中自己定义,这里我就不 ...
- iOS摄像头和相册-UIImagePickerController常用操作
在一些应用中,我们需要用到iOS设备的摄像头进行拍照,视频.并且从相册中选取我们需要的图片或者视频. 关于iOS摄像头和相册的应用,可以使用UIImagePickerController类来完成控制. ...
- 深入理解gradle编译-Android基础篇
深入理解gradle编译-Android基础篇 导读 Gradle基于Groovy的特定领域语言(DSL)编写的一种自动化建构工具,Groovy作为一种高级语言由Java代码实现,本文将对Gradle ...
- android基础---->JSON数据的解析
上篇博客,我们谈到了XML两种常用的解析技术,详细可以参见我的博客(android基础---->XMl数据的解析).网络传输另外一种数据格式JSON就是我们今天要讲的,它是比XML体积更小的数据 ...
随机推荐
- WARNING: arch/arm/mach-omap2/built-in.o(.text+0x12cdc): Section mismatch in reference from the function mmc0_init() to the (unknown reference) .init.data:(unknown)
解决方法,找到对应的不能使用 __init 字眼的地方,删除他即可. 最后删除 296 static struct omap2_hsmmc_info am335x_mmc[] __initdata = ...
- signal(SIGCHLD, SIG_IGN)和signal(SIGPIPE, SIG_IGN);
signal(SIGCHLD, SIG_IGN); //忽略SIGCHLD信号,这常用于并发服务器的性能的一个技巧 //因为并发服务器常常fork很多子进程,子进程终结之后需要//服务器进程去wait ...
- /dev/sdxx is apparently in use by the system; will not make a filesystem here! 解决方法
在存储上共享了一个500G的空间,映射到Linux系统提供上,环境由2个节点组成. 一. 测试一: 直接mount 用fdisk 格式化之后如下: [root@rac1 u01]# fdisk -l ...
- shell脚本----if(数字条件,字符串条件,字符串为空)
二元比较操作符,比较变量或者比较数字. 注意数字与字符串的区别. 1.整数比较 -eq 等于,如:if [ "$a" -eq "$b" ] -ne 不等于,如 ...
- 使用 OpCache 提升 PHP 5.5+ 程序性能
说明 PHP 5.5 以后内建了 OpCache , OpCache 的加速原理是把编译后的 bytecode 存储在内存里面, 避免重复编译 PHP 所造成的资源浪费. 引用 How To Enab ...
- php插入htm htm插入php的变量
<?php $file = "ueditor\php\upload\image\*\*.png"; foreach (glob("$file") as $ ...
- 【转】【MySql】Update批量更新与批量更新多条记录的不同值实现方法
批量更新 mysql更新语句很简单,更新一条数据的某个字段,一般这样写: UPDATE mytable SET myfield = 'value' WHERE other_field = 'other ...
- Spring中 classpath* 和 classpath 前缀的区别
// org.springframework.core.io.support.ResourcePatternResolver /** * Pseudo URL prefix for all match ...
- C++ 基本的输入输出
C++ 基本的输入输出C++ 标准库提供了一组丰富的输入/输出功能,我们将在后续的章节进行介绍.本章将讨论 C++ 编程中最基本和最常见的 I/O 操作. C++ 的 I/O 发生在流中,流是字节序列 ...
- FFMPEG的解码后的数据格式
这两天在阅读电视转发服务器中的流媒体底层库的源码时,在看到显示部分的时候,遇到了一些疑问: 就是在用d3d做显示时候,我们显示的数据格式,指定为yv12,对于YV12的数据格式在内存中的分布,可以参考 ...