0

我正在检索数据(用户信息),并从一个HashMapArrayAdpater(在列表视图中)显示它。每当我在列表视图上单击(甚至滚动)时,我的应用程序都会崩溃。

知道为什么会这样吗?这就是我正在做的事情:

//..
  Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_app_activity3);
    information=new String[50];
    Intent intent = getIntent();
    Custom custom = (Custom) intent.getSerializableExtra("custom");
    HashMap<String, String> list = custom.getList();
    //Set s = list.entrySet();
    Iterator items=list.values().iterator();
    int i=0;
    while (items.hasNext())
    {
        information[i]=(String) items.next();
        System.out.println(information[i]);
        i++;
    }
    lv = (ListView)findViewById(R.id.listview1);
    lv.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,information));
    lv.setTextFilterEnabled(true); 
}

这是我的Logcat:

system.NativeStart.main(Native Method) 01-22 22:45:22.496: I/Process(332): 发送信号。PID:332 SIG:9

4

1 回答 1

0
ListView lv = (listView) findViewById(R.Id.listView1);

进一步定义您的 ListView。

于 2013-02-16T14:23:22.703 回答