Android: Renaming file keeps giving error -
the file exists on phone, not change name.
string filestatus = "failed"; try{ file file1 = new file(""+file); file newname1 = new file(""+newname); boolean renamed = file1.renameto(newname1); if(renamed == true){ filestatus = "succeded"; } }catch(exception e){ }
renamed stays false defined in beginning. nothing else happens. permissions write_external_storage available.
add permission in android application androidmanifest.xml:,
<uses-permission android:name="android.permission.write_external_storage" />
Comments
Post a Comment