Bonjour ,
Me voici encore confronté à un souci .. !
Suite à mon précédent topic : [ListView] Adapater / NullPointerException , page 2 , on ma conseiller une technique pour afficher les enregistrements par paquet (10 à 10 etc ... ) avec un bouton de suite . !
J'ai donc déduit qu'on parlais d'un LayoutInflater, j'ai donc créer mes expandableList...
Bon maintenant le cœur du sujet :
1 - Cela marche quand je le fait de manière STATIQUE ! Avec une chaine de string...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 public ExpandableAdapterBis(Context _context, String[] _array, int _pagination) { mArray=_array; mContext=_context; pagination=_pagination; current_page=1; mInflater =LayoutInflater.from(_context); };2 - L'adaptation de mon Arraylist dans celui ci ne marche pas ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 private String[] mArray=new String[] { "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cote d'Ivoire", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Cook Islands", "Costa Rica", "Croatia", "Cuba" }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second); mListView=(ListView)findViewById(R.id.listView1); mExpandableAdapter = new ExpandableAdapterBis(this, mArray, 11); mListView.setAdapter(mExpandableAdapter);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 public ExpandableAdapterBis(Context _context, ArrayList<String> personnes, int _pagination) { // TODO Auto-generated constructor stub mContext=_context; pagination=_pagination; current_page=1; mInflater =LayoutInflater.from(_context); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second); /*mListView=(ListView)findViewById(R.id.listView1); mExpandableAdapter = new ExpandableAdapterBis(this, mArray, 11); mListView.setAdapter(mExpandableAdapter);*/ DatabaseHelper dbh; try { dbh = new DatabaseHelper(this.getApplicationContext()); mListView=(ListView)findViewById(R.id.listView1); mExpandableAdapter = new ExpandableAdapterBis(this,dbh.getPersonnes(), 11); mListView.setAdapter(mExpandableAdapter); } catch (IOException e) { e.printStackTrace(); }
Merci à vous ,
Toujours des topics à ce tirer les cheveux...
Partager