将URI转变成file


try {

        Intent intent = getIntent();
Uri uri = intent.getData();   // 比如此时的uri为   file:///mnt/sdcard/external_sd/test.txt
File file = new File(new URI(uri.toString()));
Log.i(TAG, file.getAbsolutePath());
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

你可能感兴趣的:(File)