Osb*_*Cox 3 java android hashmap android-studio
我在非活动类中声明了一个哈希映射,如下所示:
public class Wifi {
HashMap<String, String> AccessPoints = new HashMap<String, String>();
AccessPoints.put("AP1", "first_ap");
public ArrayList<Integer> scanWifi(Context context) {
// code here
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试将数据添加到哈希映射中,但我在Android Studio中收到"无法解析符号"错误.
当我放在类AccessPoints.put("AP1", "first_ap");中的一个函数中时,它似乎工作.
AccessPoints.put("AP1", "first_ap");
Run Code Online (Sandbox Code Playgroud)
调用方法应该在以下块内完成:
| 归档时间: |
|
| 查看次数: |
3748 次 |
| 最近记录: |