Android TimePicker AM/PM button not invoking onTimeChanged -



Android TimePicker AM/PM button not invoking onTimeChanged -

i'm having issues implementing timepicker in application allows user alter time of database record prior inserting it.

the problem when am/pm button pressed, ontimechanged(view, int, int) method isn't invoked. whenever alter either hr or min value of timepicker, ontimechanged() called, however.

scenarios:

user clicks am/pm button: am/pm not updated user clicks hours/minutes: time updated user clicks am/pm button changes hours/minutes: time , am/pm updated

am wrong in thinking am/pm button should able clicked update time without having alter time value after am/pm button?

i've set little test project replicate , here's code:

activity

public class testactivity extends activity implements ontimechangedlistener { private calendar mcalendar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.timepicker); mcalendar = calendar.getinstance(); timepicker tp = (timepicker)findviewbyid(r.id.timepicker); tp.setis24hourview(false); tp.setontimechangedlistener(this); } @override public void ontimechanged(timepicker view, int hourofday, int minute) { log.d("tag", "in ontimechanged"); mcalendar.set(mcalendar.get(calendar.year), mcalendar.get(calendar.month), mcalendar.get(calendar.day_of_month), hourofday, minute); setcalendartime(); } private void setcalendartime() { date date = mcalendar.gettime(); if (date != null) { simpledateformat formatter = new simpledateformat("mm/dd/yy '@' h:mm a"); string datetime = formatter.format(date); toast.maketext(this, datetime, toast.length_long).show(); } } }

timepicker.xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true"> <timepicker android:id="@+id/timepicker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="5dip" android:layout_marginright="5dip"/> </linearlayout>

i have tested code. yes, right, timepicker am/pm button not invoking ontimechanged method should.

actually, bug. has been reported google. can find here http://code.google.com/p/android/issues/detail?id=18982

please vote, comment & star bug study raise priority , fixed development team possible.

android timepicker

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -