获取T卡上中文路径.

发送点击过来后取得的路径:
在对应的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;
	}

你可能感兴趣的:(android,String,File,null,action)