标签:
Camera
file:///E:/baiduyunpan/android_doc_v1.0/android_doc/guide/topics/media/camera.html#considerations
<uses-permission android:name="android.permission.CAMERA" />
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /** * 拍照 * @param v */ public void takephoto(View v){ Intent intent = new Intent(); //拍照 intent.setAction(MediaStore.ACTION_VIDEO_CAPTURE ); File file = new File(Environment.getExternalStorageDirectory().getPath(),"paizhao.3gp"); //使用到了sd卡所以还需要在清单文件中增加sd卡读写权限 intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); // 开启意图 startActivityForResult(intent, 1); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Toast.makeText(getApplicationContext(), "保存成功", 1).show(); super.onActivityResult(requestCode, resultCode, data); } }
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
* 拍照
* @param v
*/
public void takephoto(View v){
Intent intent = new Intent();
//拍照
intent.setAction(MediaStore.ACTION_VIDEO_CAPTURE );
File file = new File(Environment.getExternalStorageDirectory().getPath(),"paizhao.3gp");
//使用到了sd卡所以还需要在清单文件中增加sd卡读写权限
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
// 开启意图
startActivityForResult(intent, 1);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Toast.makeText(getApplicationContext(), "保存成功", 1).show();
super.onActivityResult(requestCode, resultCode, data);
camera 摄像机
原文地址:http://www.cnblogs.com/candledragle/p/4232645.html