You are using following method:
public static Bitmap getThumbnail (ContentResolver cr, long origId, int kind, BitmapFactory.Options options)
Parameters:
cr -> ContentResolver used to dispatch queries to MediaProvider.
origId -> Original image id associated with thumbnail of interest.
kind -> The type of thumbnail to fetch. Should be either MINI_KIND or MICRO_KIND.
options -> this is only used for MINI_KIND when decoding the Bitmap
Returns
A Bitmap instance. It could be null if the original image associated with origId doesn't exist or memory is not enough.
If you have Image Uri then you will get id from following:
imageUri.getLastPathSegment()
or
String wholeID = DocumentsContract.getDocumentId(imageUri);
String id = wholeID.split(":")[1];
Long origId = Long.parseLong(id);
Now origId you have to pass into getThumbnail()