I was able to get the mac address of the router; But when I compare it it shows nothing. Can anyone tell me where I'm wrong?
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
getMacId();
// myTimer.scheduleAtFixedRate(myTimerTask, 0, 5000);
display.setText(" Mac Address of current connected wifi is");
// MacText.setText(getMacId());
String MacID = getMacId();
box.setText(MacID);
String rajaWing = "f4:7f:35:5f:43:50" ;
String usmanWing = "f4:7f:35:5f:43:a0";
String shahzadWing = "00:3a:98:88:91:a0";
//sets location name
if (getMacId() == "usmanWing") {
MacText.setText("Usman's Wing");
}
String is an Object.
In order to compare its value, not its memory address, use
String.equals(String);