以下のようなパスと uri を返す MediaScannerConnectionClient があります。
path=/sdcard
uri= content://media/external/images/media/9834
uri の絶対パスを見つける方法は? 私は以下を試して失敗し、行 Log.d(TAG,"after new File");
実行されません。
行の実行にエラーがあるようです
new File(new URI(uri.getPath()))
どんな助けでも大歓迎です。-よろしく、まんじゅう
File myFile=null;
try {
myFile=new File(new URI(uri.getPath()));
Log.d(TAG,"after new File");
} catch (URISyntaxException e) {
e.printStackTrace();
} catch (IllegalArgumentException e){
e.printStackTrace();
}
if(myFile!=null && myFile.exists()){
Log.d(TAG,"file exists");
Log.d(TAG,"FilePath: "+myFile.getAbsoluteFile());
}else{
Log.d(TAG,"given file DOESNOT exist");