private Cursor getEvents() { // TODO Auto-generated method stub events = new EventsData(this); events.getWritableDatabase(); SQLiteDatabase db = events.getWritableDatabase(); Cursor cursor = db.rawQuery("SELECT unameTEXT FROM " + TABLE, null); startManagingCursor(cursor); return cursor; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view); bt = (Button) findViewById(R.id.back); bt.setOnClickListener(this); text = (TextView) findViewById(R.id.output); EventsData events = new EventsData(this); events.getWritableDatabase(); Cursor cursor = getEvents(); showEvents(cursor); }
private void showEvents(Cursor cursor) { StringBuilder builder = new StringBuilder("----------------- Credentials -----------------\n"); while (cursor.moveToNext()) { String name = cursor.getString(0); builder.append("------> "); builder.append(name); builder.append("\n"); } events.close(); text.setText(builder); }