Я написал следующий код для извлечения данных из моей базы данных и отображения всех найденных объектов в окне журнала, но он не показывает .. help?
public void afisareOferta() throws Exception {
String selectQuery = " SELECT * FROM " + DBConst.tabela;
Cursor cursor = db.rawQuery(selectQuery,null);
String result;
if(cursor.moveToFirst()) {
do {
//HomeExchange hm = new HomeExchange();
result = cursor.getString(0) + cursor.getString(1) + cursor.getString(2) + cursor.getString(3 ) + cursor.getString(4);
/* hm.setLocalitatea(cursor.getString(0));
hm.setTipLocuinta(cursor.getString(1));
hm.setNrCamere(cursor.getInt(2));
hm.setData(cursor.getString(3));
hm.setDurata(cursor.getInt(4));*/
Log.i("Citire din bd:", result);
}
while (cursor.moveToNext());
}
}
Logcat:
07-02 20:57:53.933 1969-1969/com.example.colega.restanta20182altfeldeafisaredata D/ViewRootImpl@9a0e50e[MainActivity]: ViewPostIme pointer 0
07-02 20:57:54.001 1969-1969/com.example.colega.restanta20182altfeldeafisaredata D/ViewRootImpl@9a0e50e[MainActivity]: ViewPostIme pointer 1
07-02 20:58:14.594 1969-1969/com.example.colega.restanta20182altfeldeafisaredata D/ViewRootImpl@9a0e50e[MainActivity]: ViewPostIme pointer 0
07-02 20:58:14.699 1969-1969/com.example.colega.restanta20182altfeldeafisaredata D/ViewRootImpl@9a0e50e[MainActivity]: ViewPostIme pointer 1
это появляется, когда я нажимаю следующую кнопку:
bRead.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DBAdapter db = new DBAdapter(getApplicationContext());
db.openConnection();
try {
db.afisareOferta();
} catch (Exception e) {
e.printStackTrace();
}
db.closeConnection();
}
});