使用fragment過程中setAdapter空

2021-07-25 18:01:24 字數 621 閱讀 7487

按照教程自己在學習android,其中在在學asynctask獲取資料後繫結到listview,我結合以前學的fragment結合到了一起,但是問題來了

fragment1為第乙個介面載入乙個frist.xml,frist.xml裡放了乙個listview,還有乙個listview_item.xml做的listview的布局

然後在mainactivity寫的asynctask獲取網路資料,然後在onpostexecute裡繫結adapter

@override 

protected void onpostexecute(listbbsbeanlist)

執行後說lisview為空指標,報錯行是

bbsadapter bbsadapter = new bbsadapter(mainactivity.this, bbsbeanlist);  

個人感覺lisview是fragment1裡,乙個是

mainactivity.this

錯誤,但是不知道怎麼寫,請指教

在oncreate裡

mlistview = (listview) findviewbyid(r.id.index_index_listview); 

儲存過程中,if語句使用

if語句 判斷使用者輸入的數字 set serveroutput on 1.提示資訊 2.接收鍵盤輸入 num 是乙個位址值 sql優化 num繫結變數 盡量使用繫結變數 select from emp where deptno 10 執行計畫 select from emp where deptn...

儲存過程中的游標使用

利用儲存過程來消除資料庫中冗餘的資料 create procedure sp mytest as declare pro varchar 50 declare mm int declare wu cursor for select distinct product from mytest open ...

儲存過程中游標的使用

例如 乙個公司,按照如下規則計算加薪金額 1.公司中除了總裁 president 外,所有人都會至少增加p min的薪水 2.任何獎金 bonus 高於 600的員工都會另增加4 3.員工的佣金 commission 越高,增加越少。佣金 commission 少於 2000的另增加3 佣金 com...