android camera
1、调用系统的camera
1.1
保存的缩略图
package com.example.camera; import java.io.FileOutputStream; import android.os.Bundle; import android.provider.MediaStore; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.view.Menu; import android.widget.ImageView; public class MainActivity extends Activity { private static final int CAMERA_REQUST_CODE=1; private ImageView photo=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); photo=(ImageView)findViewById(R.id.imageView1); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent,CAMERA_REQUST_CODE); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode==CAMERA_REQUST_CODE) { // 系统相机返回处理 Bitmap cameraBitmap = (Bitmap) data.getExtras().get("data"); photo.setImageBitmap(cameraBitmap); super.onActivityResult(requestCode, resultCode, data); } } }