1. Download our Official Android App: Forums for Android!

Apps How do I customise a preference to display a time picker widget through XML

Discussion in 'Android Development' started by Markie Mark, Feb 19, 2011.

  1. Markie Mark

    Markie Mark Lurker
    Thread Starter
    Aug 18, 2010

    Aug 18, 2010
    Hey guys!

    Firstly I'd like to say that I have only been working on Android for about a week now, so I guess you can consider me a newb! Therefore I apologise in advance if the solution is overly simple, but I can assure you that I have done my research before posting here, and haven't found an appropriate solution as of yet (or maybe I have and don't fully realise it!). Nonetheless, having lots of fun and just want to solve this problem and learn, so here goes...

    The Application

    The application I am developing is essentially a reminder service, and I am currently working on the preferences screen.

    The Problem

    I would like the user to be able to specifiy a time when he/she will be reminded daily. I want this selection to be done via the preferences screen. This is how my preferences screen looks so far...

    My preferences screen

    My Question

    Ideally, whenever the user selects the "Alarm Time" preference, I would like the following to appear (this is a screenshot of a preference from another application - PillReminder).

    Preference with Time Picker widget (taken from another app - "PillReminder")

    My question is, what is the best way to create this? I really want to keep all the visual aspects of the application using only XML, therefore I don't want a Java solution. Is this possible or am I completely off track? Other potential solutions I have heard of are using themes, alert dialogs and extending preference classes etc. Maybe some of these are correct, but I am unsure.

    Any help would be greatly appreciated, thanks! :)


Share This Page