how can I get the actual file path on the SD card where a content:// uri is pointing for an image?
Content URIs have syntax content://authority/path/id, read here. Parse id from content URI and query MediaStore.Images.Media.EXTERNAL_CONTENT_URI as follows:
long id = ContentUris.parseId(Uri.parse(contentUri));
Cursor cursor = getContentResolver()
.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[]{ MediaStore.Images.Media.DATA },
MediaStore.Images.Media._ID + " = ?", new String[]{ Long.toString(id) },
null);
if (cursor.moveToNext()) {
path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
}
cursor.close();