我想顯示完整路徑的文件名。我得到完整的路徑,但不知道如何獲得擴展名的文件名? 請給我看一些例子。如何從路徑中獲取文件名
代碼,我用它來獲取文件的完整路徑:
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