Android TimePicker AM/PM button not invoking onTimeChanged

前端 未结 11 1129
半阙折子戏
半阙折子戏 2021-02-05 12:38

I\'m having some issues implementing a TimePicker in my application that allows the user to change the time of a database record prior to inserting it.

The problem is th

11条回答
  •  醉话见心
    2021-02-05 13:26

    i make this method thats return true if the TimePicker select AM and false if the TimePicker select PM. note: the suppresLint is for Api 8 don't work .getvalue() statement

    Saludos!! :)

    @SuppressLint("NewApi")
    private boolean isAM(TimePicker timePicker){
        NumberPicker numberPickerAmPm  = (NumberPicker)((ViewGroup) timePicker.getChildAt(0)).getChildAt(3);
        if(numberPickerAmPm.getValue()==0){
            //sendToast("es am");
            return true;
        }else{
           //sendToast("es pm");
            return false;
        }
    
    }
    

提交回复
热议问题