Here is the code I use to start the camera, take the picture and save it:
Using java Syntax Highlighting
- 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);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Here is the code I use to retrieve the picture from the sd card:
Using java Syntax Highlighting
- 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);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
And here is the xml imageview markup:
Using xml Syntax Highlighting
- <ImageView android:id="@+id/add_image_preview"
- android:layout_width="320dp"
- android:layout_height="480dp"
- android:scaleType="fitXY"
- android:visibility="gone"/>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
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?

