데이터베이스에서 데이터를 가져 와서 listview에 채 웁니다. 난()이 데이터가 존재하지만 목록보기 아무것도 보여 cursor.count을 통해 확인했다 : 나는 SDCARD에서 사진을 얻을 수있는 방법SimpleCursorAdapter를 사용하여 데이터베이스에서 listview를 채우는 방법
rubDb.open();
cur = rubDb.getRubParent();
startManagingCursor(cur);
Log.d("cursor length",Integer.toString(cur.getCount()));
String[] from = new String[] { RubriqueDbAdapter.RUB_NOM, RubriqueDbAdapter.RUB_VISUEL };
int[] to = new int[] {R.id.title, R.id.icon};
listAdapter = new SimpleCursorAdapter(this, R.layout.itemgauche, cur, from, to);
listeGauche.setAdapter(listAdapter);
public Cursor getRubParent() {
Cursor cursorResults = mDb.rawQuery("SELECT * FROM " + TABLE_RUBRIQUE + " WHERE rub_id_parent = 0 ORDER BY rub_ordre ASC", null);
return cursorResults;
}
과에 넣어 : 나는 simpleCursorAdapter을 사용/
을 이미지 뷰를 listview에?
도움 주셔서 감사합니다.
어댑터 클래스에서 getView() 메소드를 게시하십시오. – FoamyGuy
getView()를 오버라이드하지 않았습니다 : s – Remy
좋아, ArrayAdapter, getView() 메소드를 확장하는 customlistadapter를 만들지 만 지금 데이터베이스에서 올바른 제목 추출로 setText를 만드는 방법은 무엇입니까? tx – Remy