DB에 저장 되어 있는 전화번호와
ListView(멀티 체크)에 저장 되어 있는 값을 비교하여 DB에 있는 전화번호는
ListView에 체크가 되게 하고 싶습니다.
좀 알려주세요 ㅠㅠ
DB ListView
안드로이드 자바 V
자바 안드로이드 V
C 언어
파스칼
위 처럼 DB에 있는 값은 ListView가 실행 되었을때 체크가 될수 있도록 !!!
요지는 이것입니다.ㅠㅠ 알려주세요
private void setup_listView() { // TODO Auto-generated method stub Toast.makeText(this, "Save", Toast.LENGTH_SHORT).show(); Cursor DB_c; ListView v = getListView(); Adapter adapter = v.getAdapter(); db_phone = new Phone_Number_DB(this, null, null, 0); String id; try{ db = db_phone.getWritableDatabase(); }catch(SQLiteException ex){ db = db_phone.getReadableDatabase(); } DB_c = db.rawQuery("SELECT id FROM phone_number;", null); int test_count = v.getChildCount(); Toast.makeText(this, "test_count : "+test_count, Toast.LENGTH_SHORT).show(); while(DB_c.moveToNext()) { for(int i=0; i<v.getChildCount(); i++) { Toast.makeText(this, "for 문", Toast.LENGTH_SHORT).show(); Cursor c = (Cursor) adapter.getItem(i); id = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone._ID)); Toast.makeText(this, "id : " + id, Toast.LENGTH_SHORT).show(); if(id.equals(DB_c.getString(0).toString())) { v.setItemChecked(i, true); } else { v.setItemChecked(i, false); } } }
}
v.getChildCount() 여기가 0으로 나오는데 뭐가 잘못된걸까요? ㅠㅠ
제발 알려주세요
로그인 유지
DB에 저장 되어 있는 전화번호와
ListView(멀티 체크)에 저장 되어 있는 값을 비교하여 DB에 있는 전화번호는
ListView에 체크가 되게 하고 싶습니다.
좀 알려주세요 ㅠㅠ
DB ListView
안드로이드 자바 V
자바 안드로이드 V
C 언어
파스칼
위 처럼 DB에 있는 값은 ListView가 실행 되었을때 체크가 될수 있도록 !!!
요지는 이것입니다.ㅠㅠ 알려주세요
private void setup_listView() {
// TODO Auto-generated method stub
Toast.makeText(this, "Save", Toast.LENGTH_SHORT).show();
Cursor DB_c;
ListView v = getListView();
Adapter adapter = v.getAdapter();
db_phone = new Phone_Number_DB(this, null, null, 0);
String id;
try{
db = db_phone.getWritableDatabase();
}catch(SQLiteException ex){
db = db_phone.getReadableDatabase();
}
DB_c = db.rawQuery("SELECT id FROM phone_number;", null);
int test_count = v.getChildCount();
Toast.makeText(this, "test_count : "+test_count, Toast.LENGTH_SHORT).show();
while(DB_c.moveToNext())
{
for(int i=0; i<v.getChildCount(); i++)
{
Toast.makeText(this, "for 문", Toast.LENGTH_SHORT).show();
Cursor c = (Cursor) adapter.getItem(i);
id = c.getString(c.getColumnIndex(ContactsContract.CommonDataKinds.Phone._ID));
Toast.makeText(this, "id : " + id, Toast.LENGTH_SHORT).show();
if(id.equals(DB_c.getString(0).toString()))
{
v.setItemChecked(i, true);
}
else
{
v.setItemChecked(i, false);
}
}
}
}
v.getChildCount() 여기가 0으로 나오는데 뭐가 잘못된걸까요? ㅠㅠ
제발 알려주세요