이런식으로 DB에 저장된 값을 커서객체로 끌어다가
어뎁터에 넣고
리스트뷰로 보여지게 했는데
실행시키면 글자가 보이질 않습니다;;
주요 소스코드 입니다.
helper = new DBHelper(this, "data.db", null, 1);
db = helper.getWritableDatabase();
Cursor cursor = db.rawQuery("SELECT _id,name,score FROM data", null);
db.execSQL("INSERT INTO data VALUES(null,'ㅇ','ㅁ')");
@SuppressWarnings("deprecation")
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_1, cursor, new String[] {
"name", "score" }, new int[] { R.id.textView1,
R.id.textView2 });
ListView list = (ListView) this.findViewById(R.id.list);
list.setAdapter(adapter);
XML 입니다
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/back"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="선택 항목 : "
android:textColor="#000000" />
<TextView
android:id="@+id/selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="선택된 것이 없음" />
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="370dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/Gomain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="메인으로 가기" />
</RelativeLayout>
</LinearLayout>