2017-06-29 4 views
0

ich das Problem Geting Uri.getPath haben() umfasst/-1/1/wie unten, die Uri wurde immer innerhalbAndroid Uri.getPath() hat/-1/1/vor

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

aus mehreren Bildern PICK folgend

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

ich habe versuchen Datei aus Uri, die folgenden Beispielcodes immer Fehler immer zu bekommen: 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 wenn ich wie folgt bekomme und auf lokale Datei speichere: es kann gemacht werden.

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

Aber ich kann zunächst lokal zu sicherem Eingangsstrom tun, bitte helfen, ich habe die Suche schon, aber nicht sicher, dass das Uri-Format oder jetzt geändert wurde.

Wie behandelt man Datei mit Pfad von Uri? . Dank

Antwort

Verwandte Themen