我想显示完整路径的文件名。我得到完整的路径,但不知道如何获得扩展名的文件名? 请给我看一些例子。如何从路径中获取文件名
代码,我用它来获取文件的完整路径:
if (resultCode == Activity.RESULT_OK) {
Log.i("On onActivityResult", "get path");
Uri selectedVideoUri = data.getData();
try {
String filemanagerstring = selectedVideoUri.getPath();
String selectedVideoPath = getPath(selectedVideoUri);
if (selectedVideoPath != null) {
filePath = selectedVideoPath;
Log.i("VideoFilePath", "" + filePath);
} else if (filemanagerstring != null) {
filePath = filemanagerstring;
Log.i("FilePath", "" + filePath);
} else {
Toast.makeText(getApplicationContext(), "Unknown path",
Toast.LENGTH_LONG).show();
Log.e("Bitmap", "Unknown path");
Log.i("FilePath", "" + filePath);
}
你用什么代码获取路径.....? – 2011-05-10 06:56:16