I would like to set up a time picker in a preference screen and allow the user to pick both a start time and also an end time and store it as a persistant value like other settings.
Could you show all the coding needed to set this up because I couldn’t find anything like that by searching.
I’m thinking maybe the time picker should be in a dialog but I don’t yet know how to set those up yet. If you can show coding that calls a dialog with a start and end time time picker and how to save that information for later retrieval from a preferences screen that would be great.
All help will be greatly appreciated.
Truly,
Emad
I have a simple
TimePreferencethat I use in one of my books:A production-grade implementation of this would use string resources for the two button captions. It might also have a bit more error checking on the value, in case some code updates it via
SharedPreferences.Editorand does not format it properly.