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
|
@Override
public void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState);
setContentView(R.layout.MyActvity);
...
Bouton_Sexe.setOnClickListener(new View.OnClickListener() {
}
...
ListeView = (ListView) findViewById(R.id.MyListView);
ArrayList<HashMap<String, String>> listItem = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map;
if (Bouton_Sexe.isChecked()) {
//recuperation du curseur de données homme dans resultat
}
else {
//recuperation du curseur de données femme dans resultat
}
if (resultat.getCount() != 0) {
resultat.moveToFirst();
for (int i=1; i<resultat.getCount() +1; i++) {
map = new HashMap<String, String>();
map.put("Val1", resultat.getString(2););
listItem.add(map);
resultat.moveToNext();
}
SimpleAdapter mSchedule = new SimpleAdapter (this.getBaseContext(), listItem, R.layout.itemListView,
new String[] {"Val1"}, new int[] {R.id.val1});
ListeView.setAdapter(mSchedule);
} |
Partager