我能夠得到路由器的MAC地址;但是當我比較它時什麼也沒有顯示。誰能告訴我我哪裏錯了?比較Android中的mac地址?
@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");
}
可能的重複[如何比較Java中的字符串?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) – Gumbo 2014-09-21 15:21:33