1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
package com.example.trainingcenter;
public class Main3 extends ListActivity {
//private Button recherche;
// L'identifiant de notre requête
// public final static int CHOOSE_BUTTON_REQUEST = 0;
// L'identifiant de la chaîne de caractères qui contient le résultat de l'intent
// public final static String BUTTONS = "com.example.trainingcenter.Main2";
FormationBDD formationBdd;
Formation liste;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.resultat_list);
// On récupère l'intent qui a lancé cette activité
Intent i = getIntent();
String ville = i.getStringExtra(Main2.VILLE);
String catégorie = i.getStringExtra(Main2.CATEGORIE);
liste = formationBdd.getFormation(ville, catégorie);
if (liste == null)
Toast.makeText(Main3.this, "liste de formation vide ", Toast.LENGTH_LONG).show();
else
DataBind(ville, catégorie);
}
public void DataBind(String ville, String catégorie){
Cursor c = formationBdd.recupererChoixFormations(ville, catégorie);
startManagingCursor(c);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.list_item,c,new String[]{"libellé","tel","email","adresse","ville","catégorie"},
new int[]{R.id.textLibellé,R.id.TextTel,R.id.TextEmail,R.id.TextAdresse,R.id.TextVille,R.id.TextCatégorie});
setListAdapter(adapter);
}
} |
Partager