In my app I'm trying to use a custom ListView, found here:
http://www.hmkcode.com/android-custom-listview-titles-icons-counter
and I can't load the models:
Adapter Release = new Adapter(this, generateData());
// if extending Activity 2. Get ListView from activity_main.xml
ListView listView = (ListView) findViewById(R.id.listView1);
// 3. setListAdapter
listView.setAdapter(Release);
}
private ArrayList<Model> generateData() {
ArrayList<Model> models = new ArrayList<Model>();
models.add(new Model("Group Title"));
models.add(new Model(R.drawable.action_help_32,"Menu Item 1","1"));
models.add(new Model(R.drawable.action_search_32,"Menu Item 2","2"));
models.add(new Model(R.drawable.collections_cloud_32,"Menu Item 3","12"));
return models;
in the onCreateView
Is there a way to setup ActionBar tabs and change content, rather than fragments?
You can set data to adapter dynamically. You need to call notifyDataSetChanged()
on adapter after setting data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.