我的程序有问题,我正在尝试为我的文本视图名称设置一个动态值,分配给它的名称将来自地图(见下文)。当我尝试打印log cat 上的值,但是当我必须将它放在文本视图本身上时,它变为 null .. 谢谢
protected void setMap(HashMap<String, String> map) {
String value=map.get("key");
//printing on logcat works fine
System.out.println(value);
//name is a TextView, I initialized it on Oncreate()
name.setText(value);
//the setText causes NullPointerException
}