0
SQLite 데이터베이스에서 ListView로 여러 데이터를 가져 오려고하지만 작동하지 않는 것 같습니다.SimpleCusorAdapter를 사용하여 android 용 ListView를 채우십시오.
나는 developer.android.com의 메모장 예제 코드를 사용하고 있는데 내가 각 데이터베이스 항목의 제목과 본문을 얻으려고 데이터의 한 부분이 아닌 2
을 위해 잘 작동
mNotesCursor = mDbHelper.fetchAllNotes();
startManagingCursor(mNotesCursor);
String[] from = new String[]{NotesDbAdapter.KEY_TITLE, NotesDbAdapter.KEY_BODY};
int[] to = new int[]{R.id.text1, R.id.text2};
SimpleCursorAdapter notes =
new SimpleCursorAdapter(this, R.layout.notes_row, mNotesCursor, from, to);
setListAdapter(notes);
난 단지 getti 생각하는 경우 : 여기
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28dip" />
<TextView android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="28dip" />
</LinearLayout>
이 값을 결합하려고 내 코드입니다 : 데이터베이스, 내 생각 커서를 통해 뷰에 내 문제는 XML을 함께 KEY_TITLE을 TextView 하나 (예 : 메모장 자습서)가있는 .xml에 넣으면 괜찮습니다. 그러나 위에 정의 된 XML을 사용하여 실행하면 강제로 닫힙니다.
왜 그런가? 시간에 대한
감사합니다,
InfinitiFizz
Eclipse에서 'adb logcat', DDMS 또는 DDMS 퍼스펙티브를 사용하여 예외와 관련된 스택 추적을 얻으므로 문제가있는 곳을 볼 수 있습니다. – CommonsWare
죄송합니다. 이전에 안드로이드에 대한 디버깅을 해본 적이 없으니 좋은 가이드/자습서가 있습니까? –