I now think the reason why I couldn't replace the preferences file was that R.java
was not being re-generated for some reason that was hard to work out. I gave up investigating that (following here) and went back to my previous working version and re-applied changes until just before the preference work to get my app back working (shows the importance of keeping versions of your code). This was a much faster alternative for me.
I have now implemented my preferences a different way (using the example here) and have dropped the use of PreferenceFragment
. So, thanks to Marco for keeping me sane. I can now move on.