I am using the following code to use camera by using intent.
In the parameter of intent I am passing android.provider.MediaStore.ACTION_IMAGE_CAPTURE
.
It is able to
I have used the following code and it worked!
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
final Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
im.setImageDrawable(null);
im.destroyDrawingCache();
Bundle extras = data.getExtras();
Bitmap imagebitmap = (Bitmap) extras.get("data");
im.setImageBitmap(imagebitmap);
}
}