Super easy, I am sure - but in conditional if/then statements using droid, how do I go about using them with integers, ie:
int currentHour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
public void getResult(int currentHour, Intent intent) 开发者_开发百科{
if (currentHour < 14) then:
//do something
}
I know this isn't the right way to do it, but I am having a brain fart as to comparing ints...thanks!
I strongly suspect you're looking for
if (currentHour < 14) {
// do something
}
This is common to virtually all C-syntax languages.
public void getResult(int currentHour, Intent intent) {
if (currentHour < 14){
//do something
} else {
//do something else
}
}
精彩评论