kendi proje kodumdan alıntı :)
private databaseMekan vt;
ListView list;
private String [] dizi = {"id","sehir"};
ArrayList<String> array=new ArrayList<String>();
protected void KayitGoster() {
SQLiteDatabase db = vt.getReadableDatabase();
Cursor crs = db.query(databaseMekan.tablo1, dizi, null, null, null, null, null);
array.clear();
@SuppressWarnings("unused")
String gelen="";
while (crs.moveToNext()) {
String sehir=crs.getString(crs.getColumnIndex(databaseMekan.sehir));
gelen = sehir;
array.add(sehir);
}
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, array);
list=(ListView)findViewById(R.id.listView1);
list.setAdapter(adapter);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.mekan);
vt = new databaseMekan(this);
KayitGoster();
}