This question already has an answer here:
I found these two part of code, to how to take a photo from the camera in Android:
Inside the onCreate()
method:
Button capture;
capture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, TAKE_PHOTO_CODE);
}
});
And
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == TAKE_PHOTO_CODE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
}
}
And it works, but the problem is that, the quality of the result image is very low! I like to know how can I specify what quality of image I want to take?
Also like to know, are there other options that bitmap
to store or work on images?
EDIT:
This is what I see before pushing the capture button:
And this is what it takes after pushing the capture button(it reduces the quality):
I must say, when I take photos with my phone(outside of this app I mean) it works good, but inside the my written app, it reduces the taken image quality!
**Also I have another question...how can I remove this second page that shows after it took the image(the page shows RETRY-OK
options I mean).
Check below solution for your problem.