 <pre><code>import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; public class MainActivity extends Activity { /** Called when the activity is first created. */ Button btnTakePhoto; ImageView imgTakenPhoto; private static final int CAM_REQUREST = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btnTakePhoto = (Button) findViewById(R.id.button1); imgTakenPhoto = (ImageView) findViewById(R.id.imageView1); btnTakePhoto.setOnClickListener(new btnTakePhotoClicker()); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (requestCode == CAMERA_PIC_REQUEST) { Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); imgTakenPhoto.setImageBitmap(thumbnail); } } class btnTakePhotoClicker implements Button.OnClickListener { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); } } } </code></pre>