I am having an issue with taking pictures on my Sony Xperia L phone (but it works for other phones like nexus and htc) when it runs as an android activity...
After taking the picture it directly returns back with a result code of RESULT_CANCELED.
following is my code for the application...
Toast.makeText(this, "Taking snapshot", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if(intent.resolveActivity(getPackageManager()) != null){
Toast.makeText(this, " camera ready", Toast.LENGTH_SHORT).show();
startActivityForResult(intent, REQUEST_CAPTURE_PIC);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Toast.makeText(this, "back from camera...", Toast.LENGTH_SHORT).show();
if (requestCode == REQUEST_CAPTURE_PIC || resultCode == RESULT_OK) {
Toast.makeText(this, "now saving..", Toast.LENGTH_SHORT).show();
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
img.setImageBitmap(imageBitmap);
}
}
I dont that this is a code issue. I think this has something to do with my phone camera application.
Thanks in advance.