본문 바로가기
  • fishing...
  • eating...
MISCELLANEOUSNESS

URI로 파일 경로(FILE PATH) 획득하기.

by 회색뿔 2011. 1. 5.



String photoPath = null; if((photoPath = _dataProcess.getText("url", null)) == null ) return; Cursor c = context.getContentResolver().query(Uri.parse(photoPath), null, null, null, null); c.moveToFirst(); String path = c.getString( c.getColumnIndex(MediaStore.MediaColumns.DATA)); Uri uri = Uri.fromFile( new File(path)); c.close();



android에서 Uri를 알고 있고 절대경로(파일경로)를 알애야 할 때 위 처럼 하면 된다.