请教关于数据list中数组的数据的获取有关问题
请问关于数据list中数组的数据的获取问题
请问 比如说
请问 以下所说的infolist 怎么能取到 mChatList里边的a数组的值呢? 代码怎么写呢?
麻烦会的朋友帮忙回复,谢谢啦。
现在有
public List< Info> mChatList = new ArrayList< Info>();
这样一个数据list:
。。。。。。
for (i=0; i<10; i++){
String [] a ={"A","B","C"};
total =1;
mChatList.add(new Info(total,,a) ); //也就是 a是一个字符串数组
}
说明: info 类里边 是这么定义
public class info {
private int total.
private string []replyarray = new String[3];
public info (int total,String []a ) {
this.total = total;
for( int j=0;j<a.length;j++ ) {
replyarray[j]=a[j];
}
}
public String get_total() {
return total;
}
}
------------------------
请问如果通过调用 addlist( mChatList) 这个函数,
public List<Info>infolist= new ArrayList<Info>();
public void addlist( List<Info> addlist) {
try {
for ( Info Infos : addlist ) {
HashMap<String,Object> item = new HashMap<String,Object>();
item.put("total", Info.get_total());
。。。。。
infolist.add(item);
}
}
------解决思路----------------------
public List<Info>infolist= new ArrayList<Info>();
HashMap<String,Object> item = new HashMap<String,Object>();
item.put("total", Info.get_total());
。。。。。
infolist.add(item);
item 的类型 不是 Info 类型 怎么add????
------解决思路----------------------
HashMap遍历的方式
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
参考 http://www.cnblogs.com/meieiem/archive/2011/11/02/2233041.html
------解决思路----------------------
数据存储用LIst<HashMap<String, object>> infolist,HashMap<String, object> item,数组作为键值放入hashmap中,整个键值item对放入list中,取数组数据如下:infoList(position).getkey("键值")[0] 获取数组的第一个元素
请问 比如说
请问 以下所说的infolist 怎么能取到 mChatList里边的a数组的值呢? 代码怎么写呢?
麻烦会的朋友帮忙回复,谢谢啦。
现在有
public List< Info> mChatList = new ArrayList< Info>();
这样一个数据list:
。。。。。。
for (i=0; i<10; i++){
String [] a ={"A","B","C"};
total =1;
mChatList.add(new Info(total,,a) ); //也就是 a是一个字符串数组
}
说明: info 类里边 是这么定义
public class info {
private int total.
private string []replyarray = new String[3];
public info (int total,String []a ) {
this.total = total;
for( int j=0;j<a.length;j++ ) {
replyarray[j]=a[j];
}
}
public String get_total() {
return total;
}
}
------------------------
请问如果通过调用 addlist( mChatList) 这个函数,
public List<Info>infolist= new ArrayList<Info>();
public void addlist( List<Info> addlist) {
try {
for ( Info Infos : addlist ) {
HashMap<String,Object> item = new HashMap<String,Object>();
item.put("total", Info.get_total());
。。。。。
infolist.add(item);
}
}
------解决思路----------------------
public List<Info>infolist= new ArrayList<Info>();
HashMap<String,Object> item = new HashMap<String,Object>();
item.put("total", Info.get_total());
。。。。。
infolist.add(item);
item 的类型 不是 Info 类型 怎么add????
------解决思路----------------------
HashMap遍历的方式
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
参考 http://www.cnblogs.com/meieiem/archive/2011/11/02/2233041.html
------解决思路----------------------
数据存储用LIst<HashMap<String, object>> infolist,HashMap<String, object> item,数组作为键值放入hashmap中,整个键值item对放入list中,取数组数据如下:infoList(position).getkey("键值")[0] 获取数组的第一个元素