IMAGE_ID of the Thumbnail record is the id of the original image.

On Jun 25, 2:27 pm, ReyLith <jesus...@gmail.com> wrote:
> Hi!
>
> I'm developing animageeditor for android. In the main activity, I
> get to show all images by viewing thethumbnailsto make the process
> faster. The problem it's that I need to process theimagelater and I
> would get the normalimageID(with theoriginalsize, which I think
> is in MediaStore.Images.Media). I can't get the form of the query. The
> code that I have is the following but I can't obtain the realimageID
> (in the IDImage variable):
>
>         int columnIndex = 0;
>         String[] projection = {MediaStore.Images.Thumbnails._ID,
> MediaStore.Images.Thumbnails.DATA};
>
>         // It is necessary to use EXTERNAL_CONTENT_URI ofThumbnails
> because it contains the
>         // littleimageand not theoriginal
>         Cursor cursor =
> managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
>                                                          projection,
>                                                          null,
>                                                          null,
>                                                          null);
>
>         if(cursor != null)
>         {
>                 cursor.moveToPosition(position);
>
>                 columnIndex =
> cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA);
>                 String imagePath = cursor.getString(columnIndex);
>
>                 columnIndex =
> cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID);
>                 String _IDThumbnails = cursor.getString(columnIndex);
>
>                 String[] nProjection = {MediaStore.Images.Media._ID,
>                                                                 
> MediaStore.Images.Media.PICASA_ID};
>                 String nSelection = MediaStore.Images.ImageColumns.PICASA_ID
> + " = " + _IDThumbnails;
>
>                 Cursor nCursor =
> managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
>                                                                           
> nProjection, nSelection, null, null);
>
>                 nCursor.moveToFirst();
>
>                 columnIndex =
> cursor.getColumnIndexOrThrow(MediaStore.Images.Media._ID);
>                 String _IDImage = cursor.getString(columnIndex);
>
>                 FileInputStream is = null;
>                 BufferedInputStream bis = null;
>                 try
>                 {
>                         is = new FileInputStream(new File(imagePath));
>                         bis = new BufferedInputStream(is);
>
>                         // Imagen is a class that I have defined
>                        image= new Imagen(BitmapFactory.decodeStream(bis),
> _IDImage);
>                 }
>                 catch(Exception e)
>                 {
>
>                 }
>                 finally
>                 {
>                         try
>                         {
>                                 if(bis != null)
>                                         bis.close();
>
>                                 if(is != null)
>                                         is.close();
>
>                                 cursor.close();
>                                 projection = null;
>                         }
>                         catch(Exception e)
>                         {
>
>                         }
>                 }
>         }
>
> Thank you. Regards,
> Jesús

-- 
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

Reply via email to