老師逗比式學(xué)完了程序運(yùn)行不了,
ListView listView = (ListView) findViewById(R.id.lv_main); listView.setAdapter(new MyAdapter(this,itemBeanList));第二句執(zhí)行不了,報(bào)錯(cuò)說(shuō)什么空指針.....怎么解決
ListView listView = (ListView) findViewById(R.id.lv_main); listView.setAdapter(new MyAdapter(this,itemBeanList));第二句執(zhí)行不了,報(bào)錯(cuò)說(shuō)什么空指針.....怎么解決
舉報(bào)
2017-06-06
ListView listView = (ListView) findViewById(R.id.lv_main);這句一定要放在在setContentView()語(yǔ)句之后執(zhí)行,不然會(huì)返回空l(shuí)istView