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 and says: case expressions must be constant expression, it is constant I don't know what happened. Here's my code below:
public void onClick(View src)
{
switch(src.getId()) {
case R.id.playbtn:
checkwificonnection();
break;
case R.id.stopbtn:
Log.d(TAG, "onClick: stopping srvice");
Playbutton.setImageResource(R.drawable.playbtn1);
Playbutton.setVisibility(0); //visible
Stopbutton.setVisibility(4); //invisible
stopService(new Intent(RakistaRadio.this,myservice.class));
clearstatusbar();
timer.cancel();
Title.setText(" ");
Artist.setText(" ");
break;
case R.id.btnmenu:
openOptionsMenu();
break;
}
}
All R.id.int are all underlined in red.
R.id.playbtn
etc.? Is everything static and final? – StropheR
is typically generated by the IDE/dev tools, so it's usually correct for the version of Android in use. – Woodham