将URI转变成file

来源:互联网 发布:js数字转换成日期 编辑:程序博客网 时间:2024/04/27 17:37


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();
}

原创粉丝点击