안녕하세요 그냥 오류가 나는 이유는 누군가가 도움이 될 수 있습니다 모르겠어요?안드로이드 setlistAdapter 오류
이 내 JSON 피드 i는 뉴스 배열을 원하는 구성 방식입니다
{ "코드": 200, "오류": NULL, "데이터": { "뉴스": [{ "news_id" " 8086 " oneOjectsItem에서 오류가 발생했습니다.
setListAdapter (새 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