I am creating an android application that uses bluetooth to connect to a NeuroSky headset. In the following code I am getting the error of "dead code" for my if statement and cannot figure out why?
Particular code block:
(I am trying to create functionality that if the headset registers an attention rating of over 25 then the message is outputted to screen, It is here that I get the dead code error).
Note that TGDevice.MSG_ATTENTION is an int value from 0-100
case TGDevice.MSG_ATTENTION:
tv.append("Attention: " + msg.arg1 + "\n");
if(TGDevice.MSG_ATTENTION>=25){
System.out.println("Over 25...");
}
break;
Full method:
/**
* Handles messages from TGDevice
*/
final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case TGDevice.MSG_STATE_CHANGE:
switch (msg.arg1) {
case TGDevice.STATE_IDLE:
break;
case TGDevice.STATE_CONNECTING:
tv.append("Connecting...\n");
break;
case TGDevice.STATE_CONNECTED:
tv.append("Connected.\n");
device.start();
break;
case TGDevice.STATE_NOT_FOUND:
tv.append("Could not connect any of the paired BT devices. Turn them on and try again.\n");
break;
case TGDevice.STATE_ERR_NO_DEVICE:
tv.append("No Bluetooth devices paired. Pair your device and try again.\n");
break;
case TGDevice.STATE_ERR_BT_OFF:
tv.append("Bluetooth is off. Turn on Bluetooth and try again.");
break;
case TGDevice.STATE_DISCONNECTED:
tv.append("Disconnected.\n");
} /* end switch on msg.arg1 */
break;
case TGDevice.MSG_POOR_SIGNAL:
tv.append("PoorSignal: " + msg.arg1 + "\n");
break;
case TGDevice.MSG_HEART_RATE:
tv.append("Heart rate: " + msg.arg1 + "\n");
break;
case TGDevice.MSG_RAW_DATA:
/* Handle raw EEG/EKG data here */
break;
case TGDevice.MSG_ATTENTION:
tv.append("Attention: " + msg.arg1 + "\n");
if(TGDevice.MSG_ATTENTION>=25){
System.out.println("Over 25...");
}
break;
case TGDevice.MSG_MEDITATION:
tv.append("Meditation: " + msg.arg1 + "\n");
break;
case TGDevice.MSG_BLINK:
tv.append("Blink: " + msg.arg1 + "\n");
break;
default:
break;
} /* end switch on msg.what */
sv.fullScroll(View.FOCUS_DOWN);
} /* end handleMessage() */
}; /* end Handler */