/** Appel lorsque l'activite passe en arriere plan */ @Override public void onPause() { super.onPause(); // Toast.makeText(getApplicationContext(), "onPauseAcceuil()", Toast.LENGTH_SHORT).show(); // Fermeture de la BDD Log.i("CYCLE_LIFE", "On Pause Acceuil"); query.destroy(); }
public void listStation() { ArrayList<String> queryString = query.getData(new String[] {"NOM"}, null, null, null, null, "NOM", "ASC"); // Set the ListView setListAdapter( new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, queryString)); }
private Station loadData(String nomStation) { Station s = null; // On requete la Base pour recupe les donnees sur l HashMap<String, String> result = new HashMap<String, String>(); result = query.getDataFields( new String[] { "NOM", "NUMTEL", "DEMARRER", "ARRETER", "DEMMARERNOTF", "ARRETERNOTF", "ALARMEID", "ALARME_TIME", "ALARME_ACTION" }, "NOM='" + nomStation + "'", null, null, null, "NOM", "ASC"); // Recup des valeurs de la bdd String tel = result.get("NUMTEL"); String dem = result.get("DEMARRER"); String arret = result.get("ARRETER"); String demNotif = result.get("DEMMARERNOTF"); String arrNotif = result.get("ARRETERNOTF"); String alarmeID = result.get("ALARMEID"); Alarme alarme = new Alarme(); alarme.setAction(Alarme.AlarmAction.getAlarmAction(result.get("ALARME_ACTION"))); if (result.get("ALARME_TIME") != null) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(Long.parseLong(result.get("ALARME_TIME"))); alarme.setScheduleAlarm(cal); } s = new Station(nomStation, tel, dem, arret); s.setArreterNotif(arrNotif); s.setDemarrerNotif(demNotif); s.setAlarmeId(Integer.parseInt(alarmeID)); s.setAlarmeBean(alarme); return s; }
public void eraseStation(String nom) { query.removeRow("NOM", nom); }