dear experts,
using following code to use camera to take photo and then display it
in imageview to another activity.
now problem i am facing is
this code behaves differently in different firmwares and phones
for example
1) it works fine on HTC hero with 2.1
2) it gives null pointer exception on Galaxy S with 2.1 (while getting
bm = (Bitmap)data.getExtras().get("data")
3) it opens camera in nexus one but after taking picture when i press
ok button camera is not closed and it does not return to my
application
4) same case with emulator after taking picture pressing ok button
does not return to activity result.
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:
bm = (Bitmap)data.getExtras().get("data")
onPhotoTaken();
break;
}
}
protected void onPhotoTaken()
{
Bitmap bitmap =bm;
Intent myIntent = new Intent(ActivityA.this, DisplayTakenPhoto.class);
myIntent.putExtra("ImageBitmap",bitmap);
startActivity(myIntent);
}
what mistake am i doing in this?
any help would be appreciated
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en