Exemplo n.º 1
0
 @Override
 public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
   VLPPDatenbankAdapter daAdapter = new VLPPDatenbankAdapter(context);
   daAdapter.open();
   Cursor cursor = daAdapter.getAllEntries();
   int count = cursor.getCount();
   for (int i = 0; i < (count - arg2); i++) {
     cursor.moveToNext();
   }
   daAdapter.deleteNote(cursor.getInt(0));
   daAdapter.close();
   refreshList();
   return false;
 }
Exemplo n.º 2
0
 private void refreshList() {
   ListView lvListView = getListView();
   VLPPDatenbankAdapter daAdapter = new VLPPDatenbankAdapter(context);
   daAdapter.open();
   Cursor cursor = daAdapter.getAllEntries();
   int count = cursor.getCount();
   String[] eintraege = new String[count];
   int i = 0;
   while (cursor.moveToNext()) {
     String name = cursor.getString(1);
     String datum = cursor.getString(2);
     String vorlesung = cursor.getString(3);
     String wert = cursor.getString(4);
     String eintrag = name + " - " + datum + " - " + vorlesung + " - " + wert + " Euro";
     eintraege[count - 1 - i] = eintrag;
     i++;
   }
   daAdapter.close();
   lvListView.setAdapter(
       new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, eintraege));
 }