下面的代码代表一个活动性,用户选择n个字段,声明为时间选择器的对象显示小时和分钟,但用户可以选择的分钟仅为0或30。当用户选择0分钟时,当用户选择30时,如果打印的1就像用户选择1分钟而不是30分钟,这在所有三个时间标记中都会发生,我该如何解决呢?是什么原因?
Java代码:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
oreStart = "" + OrePickerInzio.getHour() + ":" + OrePickerInzio.getMinute();
oreEnd = "" + OrePickerFine.getHour() + ":" + OrePickerFine.getMinute();
orePausa = "" + OrePickerPausa.getHour() + ":" + OrePickerPausa.getMinute();
} else {
oreStart = "" + OrePickerInzio.getCurrentHour() + ":" + OrePickerInzio.getCurrentMinute();
oreEnd = "" + OrePickerFine.getCurrentHour() + ":" + OrePickerFine.getCurrentMinute();
orePausa = "" + OrePickerPausa.getCurrentHour() + "." + OrePickerPausa.getCurrentMinute();
}