Below is my code:
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cur = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] {ImageColumns._ID}, null, null,null);
if ((cur != null) && cur.moveToFirst()) {
// Integer idsArray[] = new Integer[cur.getCount()];
for (int i = 0; i < cur.getCount(); i++) {
idsArray[i] = cur.getInt(cur.getColumnIndex(ImageColumns._ID));
cur.moveToNext();
}
}
Bitmap originalImage = BitmapFactory.decodeFile(cur.getString(cur.getColumnIndex(filePathColumn[0])));
int width = originalImage.getWidth();
int height = originalImage.getHeight();
cur.close();
I want to get height and width of each images. I want to use getHeight() and getWidth() method, but code above is giving me an error. Please help me out.
Check this
You are querying only
ImageColumns._IDfield. AddMediaStore.Images.Media.DATAand it will be ok.Like this: