我想在Android中使用動態字段創建ListView。首先,我試圖設置它使用如何在Android中正確設置ArrayAdapter
String[] chars = {"TEST"};
setListAdapter(new ArrayAdapter<String>(this,R.layout.resultlist,chars));
它給我錯誤The constructor ArrayAdapter<String>(ViewTranslationsList.GrabURL, int, int) is undefined
這在下文中示出的靜態字段(字符串[]字符)。問題在哪裏?
我想在將ArrayAdapter設置爲for循環之前,將項目添加到chars
數組中。
感謝