This is another endless list implementation for Android. The endless list is a term in the Android space which means a ListView which has no fixed length. The entries are retrieved and added dynamically as a batch of entries (page). The user can page through the entries and depending on the implementation it automatically loads the next page at the end of the list or a more button is presented.
The focus of this implementation is modularity and flexibility. Which means that you can achieve a simple endless list with a couple of lines. But you can also create a very sophisticated setup.
One goal of this project was to have a modular design and replacable components.
The main component is the GenericArrayAdapter class which is a subclass of the standard Android ArrayAdapter. Every other component is hooked into the GenericArrayAdapter.
The GenericArrayAdapter does not know where the data comes from. The user of this library must implement the IPagedDataProvider interface which will provided the adapter with the data which will be presented to the user.
public class ExtremeSimpleEndlessListActivity extends ListActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_endless_list); GenericArrayAdapteradapter = new GenericArrayAdapter (this, new GenericEntryViewProvider(getBaseContext())); adapter.setDataProvider(new ExtremeSimplePagedDataProvider()); setListAdapter(adapter); adapter.new QueryTask().execute(); } }
hg clone http://hg.code.sf.net/p/andless/endless endless