[自由讨论] android列表显示失败

lwf353997454 2011-04-07
android新手

我在做显示数据库表信息的列表时出错了

SimpleAdapter adapter = new SimpleAdapter(this, data, R.layout.item,
        new String[]{"name","phone","amount"}, new int[]{R.id.name,R.id.phone,R.id.amount});
        Log.i(TAG, data.get(9).toString());
        listView.setAdapter(adapter);

到最后一行 listView.setAdapter(adapter);时报错,空指针

目前不知原因何在
dongya1987 2011-04-07
有可能listView==null
lwf353997454 2011-04-07
谢谢了,差不多,我android:id="@+id/listView"写错了,太不小心了!!!
Global site tag (gtag.js) - Google Analytics