Android : Fetching image from MediaStore.Images.Media.DATA -


sorry if it's stupid question. confused. in android app, trying path image chosen user gallery. earlier, using mediastore.images.imagecolumns.data chosen image's path this:

    cursor = getcontentresolver().query(contenturi, projection, null,             null, null);     if (cursor == null) { // source dropbox or other similar local filepath         log.d(logtag, "getrealpathfromuri : cursor null");         return contenturi.getpath();      } else {         cursor.movetofirst();         int idx = cursor                 .getcolumnindex(mediastore.images.imagecolumns.data);         string path = cursor.getstring(idx);         cursor.close();         return path;     } 

but caused issues in devices, i.e cursor returned there no such column. so, after referring stackoverflow answers, changed mediastore.images.imagecolumns.data mediastore.images.media.data. now, seems work. what's difference between mediastore.images.imagecolumns.data , mediastore.images.media.data? , don't think has kitkat version, because both mediastore.images.imagecolumns.data , mediastore.images.media.data existed api level 1. tried searching, couldn't useful info. please help.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -