applidium / HeaderListView

Android ListView with sticky headers
http://applidium.com/en/news/headerlistview_for_android/
Other
313 stars 96 forks source link

Dynamically add items instead of hard coded. #2

Closed arayray closed 10 years ago

arayray commented 11 years ago

Be able to add items for array list or set individual strings. Example:

    ListView listview = (ListView) this.findViewById(R.id.listView1);
    NewAdapter adapter = new NewAdapter(this);
    // add("name","id");
    adapter.add("Section #1", "Section");
    adapter.add("Item #1", "Item");
    listview.setAdapter(adapter);

   // Adapter add() will see if it is a section or item and process it.
  add(String name, String id) {
  if(id.equals("Section") {
    // Set Section name and stuff
    // also set unclickable
  } else if (id.equals("Item") {
    // Set Item name and stuff
  }
tokou commented 10 years ago

Hi arayray, Even though the feature you suggest might be useful in some cases, it is not in the spirit of the Adapter classes found in Android. Consequently, we do not wish to include it at the moment. Please feel free to fork the project and add it in your fork. Thanks for your feedback.