2017-07-21 33 views
0

我想填單子利用當前的活動是在其他活動,但它給錯誤:com.example.ShowListItems不是一個封閉類

com.example.ShowListItems不是一個封閉類

這裏是代碼:

ListAdapter adapterD = new SimpleAdapter(ShowListItems.this, shipmentListDetail, 
    R.layout.list_items_d, new String[]{"id", "controlnumber", "clientcn", 
    "chargeableweight", "totalpieces"}, new int[]{R.id.id, R.id.controlno, R.id.clientcn, 
    R.id.chargeableweight, R.id.totalpieces}); 

lv.setAdapter(adapterD); 

回答

0
ShowListItems.this 

這裏就是你試圖訪問從ShowListItems當前活動的問題,但類ShowListItems不包含肯定的當前活動,但我不確定你的意思,請澄清。

+0

是的,它的錯誤,但我不知道如何訪問其他活動駐留在相同的包中,我使用.class但沒有工作。 –

+0

爲什麼它不起作用?告訴我,也許我們可以一起找到解決方案。 –