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 37 38 39 40 41
|
package com.formation.bd;
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;
public class Liste extends ListActivity {
DBAdapter db;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list);
db = new DBAdapter(this);
db.open();
DataBind();
}
protected void onDestroy() {
db.close();
super.onDestroy();
}
public void DataBind(){
Cursor c = db.recupererLaListeDesCorrespondant();
startManagingCursor(c);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.liste_item,c,new String[]{"nom","prenom","adreesse","gouvernerat","mail","telephone","fonction"},
new int[]{R.id.nom,R.id.prenom,R.id.adresse,R.id.gouvernerat,R.id.mail,R.id.telephone,R.id.fonction});
setListAdapter(adapter);
}
} |
Partager