HashMap的错误,我不能加载从字符串数据 [英] Hashmap error,i can't load data from string
本文介绍了HashMap的错误,我不能加载从字符串数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我米使用HashMap的一个列表视图。
地图=新的HashMap<弦乐,对象>();
map.put(名,R.string.information);
map.put(地址,R.drawable.info3); mylist.add(地图);
// ...
我的问题是,我不能负荷串在我的HashMap(R.string.information)..当我运行它,我只能看,而不是我text..am我做错了一些数字?谢谢
<字符串名称=信息>信息< /串>
解决方案
R.string.information
只是一个 INT
。如果你想实际字符串
,用
map.put(名,的getString(R.string.information));
I m using hashmap for a listview.
map = new HashMap<String, Object>();
map.put("name", R.string.information);
map.put("address", R.drawable.info3);
mylist.add(map);
// ...
my problem is that i cant load string in my hashmap (R.string.information)..when i run it,i can only see some numbers instead of my text..am i doing something wrong?thanks
<string name="information">Informations</string>
解决方案
R.string.information
is just an int
. If you want the actual String
, use
map.put("name", getString(R.string.information));
这篇关于HashMap的错误,我不能加载从字符串数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文