android camera的简单demo
package com.example.camera; import android.os.Bundle; import android.widget.ImageView; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; public class MainActivity extends Activity { private final static int CAMERA_RESULT =0; private ImageView view; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); view=(ImageView)findViewById(R.id.imageview); Intent i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);//启动intent startActivityForResult(i, CAMERA_RESULT); } //返回接收 @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if(resultCode==RESULT_OK){ Bundle bundle=data.getExtras(); Bitmap bitmap=(Bitmap) bundle.get("data"); view.setImageBitmap(bitmap); } } }
找一个博客做自己的女朋友,不管你跟她说什么她都帮你记录,这是多么幸福的一件事啊。如果有女生能做到这点,赶尽娶回家吧!