I'm trying to get the thumbnails of some images but the documentation is very unclear about what the origId should be. I have a simple method that takes a file as parameter and returns a drawable for thumbnails like this:
Bitmap thumbnail = MediaStore.Images.Thumbnails.getThumbnail(mContext.getContentResolver(), Long.parseLong(Uri.fromFile(file).getLastPathSegment()), Thumbnails.MINI_KIND, null);
BitmapDrawable bd = new BitmapDrawable(mContext.getResources(), thumbnail);
return bd;
But I get a java.lang.NumberFormatException: Invalid long
exception whenever getThumbnail
is called.
So how should I obtain the correct origId for an image file?