Exemple #1
0
  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;
  }
Exemple #2
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    final Intent intentCommande = new Intent(this, Commande.class);
    // On recupere les donn�es du ListView
    final String nom = getListView().getItemAtPosition(position).toString();

    station = loadData(nom);

    // On serialiez l'objet Station
    try {
      intentCommande.putExtra("STATION", station.serialize());
    } catch (IOException e) {
      Log.e("SERIALIZE", e.toString());
    }
    Log.i("STATION", "CLICK ON STATION " + station.getNom());
    startActivity(intentCommande);
  }
Exemple #3
0
 @Override
 public boolean onKeyLongPress(int keyCode, KeyEvent event) {
   Log.i("STATION", "SELECTED ON STATION " + station.getNom());
   return super.onKeyLongPress(keyCode, event);
 }