The interesting piece is really this method:
Open the file in private mode - only owning application may read/write to such a file. Write the string, flush and close.
The close() should ideally be in a finally block but I'm still trying to figure out Android so this is not perfect!
Part of my bigger WorldClock project at GitHub if you are interested to contribute!