2016-02-03 52 views
0

幫我將文件名轉換爲自己的文件名。如何在android中重命名文件

我嘗試以下,但它沒有工作:

File file = new File("27.mp4"); 
File file1 = new File("abcd"); 
file1.rename(file); 
+0

歡迎堆棧溢出!你有可能提供你正在得到的具體錯誤嗎?請花一些時間閱讀[如何提問](// stackoverflow.com/help/how-to-ask)! –

+3

嘗試關注此鏈接:http://stackoverflow.com/questions/10424997/android-how-to-rename-a-file – aletede91

回答

1

的方法被稱爲renameTo

File file = new File("27.mp4"); 
File file1 = new File("abcd"); 
file1.renameTo(file);