[android-developers] Re: Is there a way to get an icon back from MediaStore

2010-01-13 Thread rben
Thank you, you are a prince among numerals

On Jan 12, 6:47 am, zero zeroo...@googlemail.com wrote:
 with sdk  2.X , thats possible
 Mediastore.Images.Thumbnails.getThumbnail(ContentResolver cr, long
 origId, int kind, BitmapFactory.Options options);

 with lower sdk versions you have to query  read in the files
 yourself, but i really don't recommend that.

 On Jan 12, 11:58 am, rben ray.benja...@gmail.com wrote:



  I know that MediaStore creates an icon for each of its files. I'm
  wondering if there is a way to get a copy of that icon back from
  MediaStore, since that would save me the hassle of doing the whole
  crop thing.

  On Jan 11, 4:00 pm, rben ray.benja...@gmail.com wrote:

   I've figured out how to get the camera to work. It's taking a 1/4
   resolution picture and I'm putting it into the gallary. Next, I want
   to create a small icon of that picture to put on a button. I've seen
   several examples and the code below is what I've been trying:

                   showMessage(Next Step is cropping - Waiting ...);
                   logDebug(Sending URI  + mOutputFileUri);

                   // now we want to grab a lower res version for the button.
                   Intent cropIntent = new 
   Intent(com.android.camera.action.CROP);
                   cropIntent.setClassName
   (com.android.camera,com.android.camera.CropImage);
                   cropIntent.setData(mOutputFileUri);
                   //cropIntent.setData(intent.getData());
                   cropIntent.putExtra(noFaceDetection, true);
                   cropIntent.putExtra(outputX, ICON_SIZE);
                   cropIntent.putExtra(outputY, ICON_SIZE);
                   cropIntent.putExtra(aspectX, 1);
                   cropIntent.putExtra(aspectY, 1);
                   cropIntent.putExtra(scale, true);
                   cropIntent.putExtra(return-data, true);
                   startActivityForResult(cropIntent, CROP_FROM_CAMERA);

   But, this blows up with a null pointer exception. I also get a warning
   in the log message stream saying the image file isn't finished
   writing.

   I've based my code on 
   this:http://stackoverflow.com/questions/1973359/android-crop-an-image-afte...

   Also, when it tries to delete the temporary file, there is an error
   because I don't have permission.

   This smells like I'm just missing something important. Can anyone
   point me in the right direction?

   Is there any other way to get an icon of the image?

   Thanks,
     Ray
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Is there a way to get an icon back from MediaStore

2010-01-12 Thread rben
I know that MediaStore creates an icon for each of its files. I'm
wondering if there is a way to get a copy of that icon back from
MediaStore, since that would save me the hassle of doing the whole
crop thing.

On Jan 11, 4:00 pm, rben ray.benja...@gmail.com wrote:
 I've figured out how to get the camera to work. It's taking a 1/4
 resolution picture and I'm putting it into the gallary. Next, I want
 to create a small icon of that picture to put on a button. I've seen
 several examples and the code below is what I've been trying:

                 showMessage(Next Step is cropping - Waiting ...);
                 logDebug(Sending URI  + mOutputFileUri);

                 // now we want to grab a lower res version for the button.
                 Intent cropIntent = new 
 Intent(com.android.camera.action.CROP);
                 cropIntent.setClassName
 (com.android.camera,com.android.camera.CropImage);
                 cropIntent.setData(mOutputFileUri);
                 //cropIntent.setData(intent.getData());
                 cropIntent.putExtra(noFaceDetection, true);
                 cropIntent.putExtra(outputX, ICON_SIZE);
                 cropIntent.putExtra(outputY, ICON_SIZE);
                 cropIntent.putExtra(aspectX, 1);
                 cropIntent.putExtra(aspectY, 1);
                 cropIntent.putExtra(scale, true);
                 cropIntent.putExtra(return-data, true);
                 startActivityForResult(cropIntent, CROP_FROM_CAMERA);

 But, this blows up with a null pointer exception. I also get a warning
 in the log message stream saying the image file isn't finished
 writing.

 I've based my code on 
 this:http://stackoverflow.com/questions/1973359/android-crop-an-image-afte...

 Also, when it tries to delete the temporary file, there is an error
 because I don't have permission.

 This smells like I'm just missing something important. Can anyone
 point me in the right direction?

 Is there any other way to get an icon of the image?

 Thanks,
   Ray
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Is there a way to get an icon back from MediaStore

2010-01-12 Thread zero
with sdk  2.X , thats possible
Mediastore.Images.Thumbnails.getThumbnail(ContentResolver cr, long
origId, int kind, BitmapFactory.Options options);

with lower sdk versions you have to query  read in the files
yourself, but i really don't recommend that.

On Jan 12, 11:58 am, rben ray.benja...@gmail.com wrote:
 I know that MediaStore creates an icon for each of its files. I'm
 wondering if there is a way to get a copy of that icon back from
 MediaStore, since that would save me the hassle of doing the whole
 crop thing.

 On Jan 11, 4:00 pm, rben ray.benja...@gmail.com wrote:

  I've figured out how to get the camera to work. It's taking a 1/4
  resolution picture and I'm putting it into the gallary. Next, I want
  to create a small icon of that picture to put on a button. I've seen
  several examples and the code below is what I've been trying:

                  showMessage(Next Step is cropping - Waiting ...);
                  logDebug(Sending URI  + mOutputFileUri);

                  // now we want to grab a lower res version for the button.
                  Intent cropIntent = new 
  Intent(com.android.camera.action.CROP);
                  cropIntent.setClassName
  (com.android.camera,com.android.camera.CropImage);
                  cropIntent.setData(mOutputFileUri);
                  //cropIntent.setData(intent.getData());
                  cropIntent.putExtra(noFaceDetection, true);
                  cropIntent.putExtra(outputX, ICON_SIZE);
                  cropIntent.putExtra(outputY, ICON_SIZE);
                  cropIntent.putExtra(aspectX, 1);
                  cropIntent.putExtra(aspectY, 1);
                  cropIntent.putExtra(scale, true);
                  cropIntent.putExtra(return-data, true);
                  startActivityForResult(cropIntent, CROP_FROM_CAMERA);

  But, this blows up with a null pointer exception. I also get a warning
  in the log message stream saying the image file isn't finished
  writing.

  I've based my code on 
  this:http://stackoverflow.com/questions/1973359/android-crop-an-image-afte...

  Also, when it tries to delete the temporary file, there is an error
  because I don't have permission.

  This smells like I'm just missing something important. Can anyone
  point me in the right direction?

  Is there any other way to get an icon of the image?

  Thanks,
    Ray
-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en