
May 13th, 2010, 06:43 AM
|
|
Registered User
|
|
Join Date: May 2010
Posts: 1
Time spent in forums: 10 m 19 sec
Reputation Power: 0
|
|
|
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:
java Code:
Original
- java 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:
java Code:
Original
- java Code |
|
|
|
mIv. setVisibility(View. VISIBLE); BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 4; Bitmap bm = BitmapFactory.decodeStream(bis, null, options); mIv.setImageBitmap(bm);
And here is the xml imageview markup:
HTML Code:
html Code:
Original
- 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?
|