こんにちは、エラーを取得し、私はなぜ誰も助けることができないのですか?Android setlistAdapterエラー
は、これが私のJSONフィードは私がニュース配列を望ん構成されている方法です
{ "コード":200、 "エラー":ヌル、 "データ":{ "ニュース":[{ "news_id":」 8086 " ここでエラーが発生します:oneOjectsItem内
setListAdapter(new ArrayAdapter(this、R.layout.single_item、oneObjectsItem));ここ
リスト要素をinitiliazing後に私のコード
// Instantiate a JSON object from the request response
JSONObject jsonObject = new JSONObject(json);
JSONArray jArray = jsonObject.getJSONArray("news");
for (int i=0; i < jArray.length(); i++)
{
JSONObject oneObject = jArray.getJSONObject(i);
// Pulling items from the array
String oneObjectsItem = oneObject.getString("title");
}
} catch(Exception e){
// In your production code handle any errors and catch the individual exceptions
e.printStackTrace();
}
setListAdapter (new ArrayAdapter<String>(this, R.layout.single_item, oneObjectsItem));
ListView list = getListView();
list.setTextFilterEnabled(true);
list.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), ((TextView) arg1).getText(),1000).show();
}
});
}
あなたが得ているエラーは何ですか? – jmishra
エラーが発生した場合はログを提供してください。または、最初に読み込んでいますか? – dcanh121