2017-06-29 2 views
0

でIはUri.getPathを(geting問題を持っている)/含ん-1/1 /以下のように、URIがアンドロイドUri.getPathは()は/ -1/1 /正面

protected void onActivityResult(int reqCode, int resultCode, Intent data) 

内部になっていましたPICK複数の画像から

ClipData.Item item = clipData.getItemAt(i); 
Uri uri = item.getUri(); 

を以下のように私には、次のサンプルコードは、常にエラーを取得して、ウリからファイルを取得しようとしている:にFileNotFound

private void getImg(Uri uri){ 
    BitmapFactory.Options options = new BitmapFactory.Options(); 
    options.inJustDecodeBounds = true; 
    BitmapFactory.decodeFile(new File(uri.getPath()).getAbsolutePath(), options); 
    int imageHeight = options.outHeight; 
    int imageWidth = options.outWidth; 
    /....... some code ... 

    // ArrayList<File> 
    mFile.add(new File(uri.getPath()); 
} 



06-29 12:33:34.829 8160-8160/com.jinn.mutita.photoImx E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: 
/-1/1/content:/media/external/images/media/15878/ORIGINAL/NONE/3385104: open failed: ENOENT (No such file or directory) 

Howeve r次のようにしてローカルファイルに保存すると、それを実行できます。

InputStream input = thiscontext.getContentResolver().openInputStream(uri); 

しかし、私は、私はすでになく、わからないURI形式が変更されたことや、今探している助けてください、ローカルに最初の安全入力ストリームに行うことができます。

Uriのパス付きファイルを処理する方法は? 。おかげ

答えて

関連する問題