Problem:
When I use my app to take a photo and store it on SD, the resolution is 160x120.
If using camera ordinary, resolution of photos is 1920x2560.
So, please help me saying what I have to do to force camera, started from the app, to take a photo in the standard high resolution?
This is the code I use for starting camera intent and saving the photo:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST) {
Bundle xz = data.getExtras();
if (xz!=null) {
Bitmap image = (Bitmap) data.getExtras().get("data");
String filePath = "/mnt/sdcard/DCIM/";
filePath += "hml.png";
try {
image.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(new File(filePath)));
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();}
catch (NullPointerException e) {
// TODO Auto-generated catch block
e.printStackTrace(); }
}}
Thanks you!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…