There is option of capture image from camera in my application.But there is problem to get image from camera. When i use ACTION_IMAGE_CAPTURE this it return nul
you can use following steps:
// create a global variable
File destination;
openCameraBtn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
destination = new File(Environment.getExternalStorageDirectory(),"image.jpg");
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(destination));
startActivityForResult(intent, CAMERA_PICTURE);
}
});
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if(requestCode == CAMERA_PICTURE && resultCode == Activity.RESULT_OK)
{
try{
FileInputStream in = new FileInputStream(destination);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 10; //Downsample 10x
Log.d("PP", " bitmap factory=========="+options);
Bitmap user_picture_bmp = BitmapFactory.decodeStream(in, null, options);
userImage.setImageBitmap(user_picture_bmp);
} catch (Exception e)
{ e.printStackTrace();
}
}
please declare permission and feature in your manifest file.
if u want in more detail then you can use following link:
http://developer.android.com/guide/topics/media/camera.html
i hope you will success.