gpt4 book ai didi

java - 在Android中比较mac地址?

转载 作者:行者123 更新时间:2023-12-01 12:30:25 25 4
gpt4 key购买 nike

我能够获取路由器的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");
}

最佳答案

getMacId() == "usmanWing" 更改为 getMacId().equals("usmanWing")

由于您要比较两个字符串,因此您应该使用 "YOUR_STRING".equals("COMPARE_STRING") 方法。

关于java - 在Android中比较mac地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25959537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com