i developing android app, pick photo gallery. in method onactivityresult(), have following codes:
protected void onactivityresult(int requestcode, int resultcode, intent intent) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, intent); if(requestcode==pick_photo && resultcode==result_ok){ this.picuri=intent.getdata(); string[] proj = { mediastore.images.media.data }; cursor cursor = this.getapplicationcontext(). getcontentresolver().query(this.picuri, proj, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.images.media.data); cursor.movetofirst(); string path=cursor.getstring(column_index); cursor.close(); }
but path returned cursor null. can possible reason?
i don't know what's value of uri
, retrieving intent result in this.picuri
have use one
in query
change uri
this.picuri
like,
this.picuri=intent.getdata(); string[] proj = { mediastore.images.media.data }; cursor cursor = this.getapplicationcontext(). getcontentresolver().query(this.picuri, proj, null, null, null);
Comments
Post a Comment