获取T卡上中文路径.

来源:互联网 发布:订票系统的数据设计 编辑:程序博客网 时间:2024/05/21 01:47
发送点击过来后取得的路径:在对应的AndroidMainfest.xml中加入:(红色)<intent-filter>    <action android:name="android.intent.action.VIEW" />    <data android:mimeType="text/plain" /><category android:name="android.intent.category.DEFAULT" /></intent-filter>――――――――――――――――――――――――――Intent gIntent = getIntent();File file = getFile(gIntent.getData());//将中文路径编码进行转化(File)。public  File getFile(Uri uri) {if (uri != null) {String filepath = uri.getPath();if (filepath != null) {return new File(filepath);    //转化}}return null;}//将中文路径编码进行转化(Uri)。public static Uri getUri(File file) {if (file != null) {return Uri.fromFile(file);}return null;}