I’m writing an application which has an interval time as a parameter and would like a field similar to the one the Timer has to set its time. Values of a few seconds to a few hours make sense for the application.
What type of field should I use?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Looks like a custom field.
Your choices with built-in fields are:
net.rim.device.api.ui.component.NumericChoiceField, which basically acts like a drop-down with numbers in it (not great when you’re talking about 60 minutes/seconds, but if you want to constrain to say 5 minute intervals or something it might be ok).net.rim.device.api.ui.component.EditFieldwith a customnet.rim.device.api.ui.text.TextFilter(you could use aNumericTextFilter, but that wouldn’t constrain you to 0-60, it’d allow any numbers).Or you can roll you own. See this article for a start on creating custom fields. You’ll probably want to override
navigationMovementto make the numbers increment/decrement on trackball up & down, and to move the focus within the field while going left & right – setting an internal state variable indicating where the focus is and overridinggetFocusRectto return an appropriate focus rectangle (be sure to callfocusRemoveandfocusAddfrom withinnavigationMovementto let the framework know you’ve updated the focus).