My switch-case statement works perfectly fine yesterday. But when I run the code earlier this morning eclipse gave me an error underlining the case statements in color red a
It was throwing me this error when I using switch in a function with variables declared in my class:
private void ShowCalendar(final Activity context, Point p, int type)
{
switch (type) {
case type_cat:
break;
case type_region:
break;
case type_city:
break;
default:
//sth
break;
}
}
The problem was solved when I declared final to the variables in the start of the class:
final int type_cat=1, type_region=2, type_city=3;