大佬们我有个憨批问题
public void tikee(String s1)
{
String a=s1;
Toast.makeText(MainActivity.this,
s1,Toast.LENGTH_SHORT).show();
if(a.equals("0059")) {
showInputDialog();
} else if (a.equals("")) {
showInputDialog();
}else if (a.equals("")) {
showInputDialog();
}else if (a.equals("23:30")) {
showInputDialog();
}else if (a.equals("00:00")) {
showInputDialog();
}else if (a.equals("00:30")) {
showInputDialog();
}else if (a.equals("1:4")) {
showInputDialog();
}else if (a.equals("01:30")) {
showInputDialog();
}else if (a.equals("02:00")) {
showInputDialog();
}else if (a.equals("02:30")) {
showInputDialog();
}else if (a.equals("03:00")) {
showInputDialog();
}else if (a.equals("03:30")) {
showInputDialog();
}else if (a.equals("04:00")) {
showInputDialog();
}else if (a.equals("04:30")) {
showInputDialog();
}else if (a.equals("05:00")) {
showInputDialog();
}else if (a.equals("05:00")) {
showInputDialog();
}else if (a.equals("06:00")) {
showInputDialog();
}
}
有没有什么改进办法啊 s1是从获取的网络时间然后转的字符串
确实让人吐血,用闹钟(是AlarmManager,别真定个闹钟出来),每半小时提醒一次,自己搜一大堆教程
使用定时器,如果是固定时间就对时间进行判断和相减得到时间差,然后在差值那么多时间启动就行。搜索定时器方面的知识
把你需要显示dialog的时间放到list中,判断list中是否含有你获取的时间
String[] times={"00:00","00:30",........};
List list=Arrays.asList(times);
public void tikee(String s1)
{ if(list.contains(s1))
showInputDialog();}