我正在用MonoDroid (C#) 制作一个应用程序,我正在尝试交换两个文件名,但它不起作用。
下面是我的代码
String x = file1.Name;
String y = file2.Name;
File f = new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), "Images/" + vehicleid + "/" + "temp" + ".jpg");
File tempfile1 = new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), "Images/" + vehicleid + "/" + x);
File tempfile2 = new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), "Images/" + vehicleid + "/" + y);
file1.RenameTo(file2);
file2.RenameTo(tempfile1);