Capturing image, saving and then displaying problem

All your problems with Audio, Video and Images.

Capturing image, saving and then displaying problem

Postby xil3 » Wed May 12, 2010 9:20 am

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:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  2.  
  3. file = new File(Environment.getExternalStorageDirectory(), ReceiptData.PICTURE_PATH + String.valueOf(System.currentTimeMillis()) + ".jpg");
  4.  
  5.  
  6.  
  7. outputFileUri = Uri.fromFile(file);
  8.  
  9. //outputFileUri = Uri.parse(file.toString());
  10.  
  11. intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
  12.  
  13. 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:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. mIv.setVisibility(View.VISIBLE);
  2.  
  3.  
  4.  
  5. BitmapFactory.Options options = new BitmapFactory.Options();
  6.  
  7. options.inSampleSize = 4;
  8.  
  9.  
  10.  
  11. FileInputStream fis = new FileInputStream(outputFileUri.getPath());
  12.  
  13. BufferedInputStream bis = new BufferedInputStream(fis);
  14.  
  15. Bitmap bm = BitmapFactory.decodeStream(bis, null, options);
  16.  
  17.  
  18.  
  19. mIv.setImageBitmap(bm);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


And here is the xml imageview markup:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <ImageView android:id="@+id/add_image_preview"
  2.  
  3.              android:layout_width="320dp"
  4.  
  5.              android:layout_height="480dp"
  6.  
  7.              android:scaleType="fitXY"
  8.  
  9.              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?
xil3
Freshman
Freshman
 
Posts: 5
Joined: Sun Apr 11, 2010 8:13 pm

Top

Postby xil3 » Thu May 13, 2010 1:29 pm

Anybody? Somebody has to know...
xil3
Freshman
Freshman
 
Posts: 5
Joined: Sun Apr 11, 2010 8:13 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 11 guests