In my Android app, I would like to be able to copy a read only file and have the new version also read only.
Using the setReadOnly() method on the destination file only returns false, showing that it failed, and of course checking the file itself shows that it has not had the read only attribute set.
--edit-- As David Given suggests below, this only applies to files on the SD card. Internal files will behave appropriately with setReadOnly().
My manifest file has the line<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
and I'm able to do all sorts of other file operations successfully in my app.
In looking for a solution I've seen a couple of people using linux commands, and they've said that this is a 'dirty' way of doing it, so is there an alternative 'clean' way available to us?
The app I'm writing is using Android 2.1 if that's relevant.