android中应用相机功能,一般有两种:一种是直接调用系统相机,一种自己写的相机。我将分别演示两种方式的使用:
第一种:是使用Intent跳转到系统相机,action为:android.media.action.STILL_IMAGE_CAMERA

import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class CameraTest_2 extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent = new Intent(); //调用照相机 intent.setAction("android.media.action.STILL_IMAGE_CAMERA"); startActivity(intent); } } 

想要测试的,可以直接新建一个项目,并且把主activity的代码换成上面的,然后运行,我测试了一下,上面这个代码并不需要权限,毕竟只是调用系统自带的程序。

更多相关文章

  1. android短信服务
  2. Android(安卓)中各种XML文件的作用
  3. Android第五十二期 - 云之讯的代码混淆
  4. Android中的strings文件中字符串的拼接
  5. android基础-界面代码
  6. Android(安卓)使用自定义注解代替重复写findViewById代码
  7. Android(安卓)startActivityForResult的使用
  8. Android代码风格指导
  9. Android(安卓)进阶16:IntentService 使用及源码解析

随机推荐

  1. 代码分析:在.Net Core中使用ref和Span<T>
  2. C#中关于Timer定时器重入问题的解决方法
  3. ASP.NET如何实现进度条效果的实例讲解
  4. MongoDB在.Net中的使用方法详解
  5. 对MVC进行数据验证详解
  6. C#中关于foreach遍历使用的深入理解
  7. 完美解决SqlDataReader指定转换无效
  8. C#连接FTP时路径出现问题的解决方法
  9. Asp.Net--详解Core的安装和介绍
  10. 有关.Net MVC长轮询的实现方法