friends,
i am using following code to take picture from android camera
string _path = Environment.getExternalStorageDirectory() + "/images/make_machine_example.png";
Uri selectedImage;
protected void startCameraActivity()
{
File file = new File( _path );
Uri outputFileUri = Uri.fromFile( file );
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult( intent,0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
switch( resultCode )
{
case 0:
Log.i( "MakeMachine", "User cancelled" );
break;
case -1:
selectedImage = data.getData();
onPhotoTaken();
break;
}
}
protected void onPhotoTaken()
{
/*try
{
Uri r= selectedImage;
String realpath = getRealPathFromURI(selectedImage);
//File file = new File(r);
}catch(Exception ex)
{}*/
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 2;
Bitmap bitmap = BitmapFactory.decodeFile( _path, options );
}
it does not pick picture taken from camera same code working fine on htc hero but on galaxy s bitmap is null.
in case of picking image form gallery when i use following code
private void SelectImageFromGallery()
{
Intent intent = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
intent.setType("image/*");
startActivityForResult(intent,0);
}
intent of activity result comes with image but in case of camera it does not and always null.
please guide what mistake am i doing?