为什么我的崩掉了。。。。。。。。。??
package com.imooc.slidingmenu;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by cherry on 2016/12/11.
*/
public class ForumActivity extends Activity{
private ListView listView;
private SimpleAdapter simp_adapter;
private List<Map<String,Object>> dataList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.forum);
listView = (ListView)findViewById(R.id.forum_list);
simp_adapter= new SimpleAdapter(this,getData(),R.layout.forumitem,new String[]{"icon","name"},new int[]{R.id.user_icon,R.id.user_name});
listView.setAdapter(simp_adapter);
}
private List<Map<String,Object>> getData(){
for(int i=0;i<20;i++){
Map<String,Object> map= new HashMap<String,Object>();
map.put("icon",R.drawable.ic_launcher);
map.put("name","用户"+i);
dataList.add(map);
}
return dataList;
}
}