views:

71

answers:

1
private void hour()
{
    Toast.makeText(this,String.valueOf(Calendar.HOUR_OF_DAY),Toast.LENGTH_LONG).show();
}
+5  A: 

Because you just parsed the value of HOUR_OF_DAY which is 11. Forever and ever.

You should create an instance of GregorianCalendar, give it the current date, and use get(Calendar.HOUR_OF_DAY)

Code sample:

Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(new Date());
int hour = calendar.get(Calendar.HOUR_OF_DAY);
WarrenFaith
I've made that type of mistake before. Makes for a good slap on the forehead when you find the bug :)
Aaron C
Thanks a lot WarrenFaith :))
zire
thats why my wrist is always tied to the table :)
WarrenFaith