Helpful Information
 
 
Category: Android Development
Capturing image, saving and then displaying problem

I'm having an issue when trying to display an image on Android 1.5 - on 1.6+ it seems to work fine, but just not on 1.5.

Here is the code I use to start the camera, take the picture and save it:
Code:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
file = new File(Environment.getExternalStorageDirectory(), ReceiptData.PICTURE_PATH + String.valueOf(System.currentTimeMillis()) + ".jpg");

outputFileUri = Uri.fromFile(file);
//outputFileUri = Uri.parse(file.toString());
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(intent, TAKE_PICTURE);


Here is the code I use to retrieve the picture from the sd card:
Code:

mIv.setVisibility(View.VISIBLE);

BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;

FileInputStream fis = new FileInputStream(outputFileUri.getPath());
BufferedInputStream bis = new BufferedInputStream(fis);
Bitmap bm = BitmapFactory.decodeStream(bis, null, options);

mIv.setImageBitmap(bm);

And here is the xml imageview markup:

HTML Code:

<ImageView android:id="@+id/add_image_preview"
android:layout_width="320dp"
android:layout_height="480dp"
android:scaleType="fitXY"
android:visibility="gone"/>


Does anyone see any issues here? It works fine on my Nexus one - I can take the picture and then it'll display it within the ImageView just fine.

On the Android 1.5 (HTC Hero) phones it just doesn't display the image - just a blank space where the image would be.

Any ideas?










privacy (GDPR)