android自动刷新列表视图项
首先,我设置一个ListView适配器android自动刷新列表视图项,android,listview,Android,Listview,首先,我设置一个ListView适配器 this.chapters = new ArrayList<String>(); ListView lvChapters = (ListView) findViewById(R.id.mangaChapterList); lvChapters.setAdapter(new ChapterListAdapter(context, R.id.lvChapters, this.chapters)); this.chapters=new ArrayL
this.chapters = new ArrayList<String>();
ListView lvChapters = (ListView) findViewById(R.id.mangaChapterList);
lvChapters.setAdapter(new ChapterListAdapter(context, R.id.lvChapters, this.chapters));
this.chapters=new ArrayList();
ListView lvChapters=(ListView)findViewById(R.id.mangaChapterList);
setAdapter(新的ChapterListAdapter(context,R.id.lvChapters,this.chapters));
之后,我将一些数据放入AsyncTask类中的“this.chapters”中。但是listview仍然为空???显示ChapterListAdapter的代码,您确定要调用已注册的观察员吗 如果ChapterListAdapters正在扩展ArrayAdapter,则应调用notifyDataSetChanged public void notifyDataSetChanged() 自:API级别1 通知附加视图基础数据已更改,它应该刷新自身
显示ChapterListAdapter的代码,您确定要调用已注册的观察员吗 如果ChapterListAdapters正在扩展ArrayAdapter,则应调用notifyDataSetChanged public void notifyDataSetChanged() 自:API级别1 通知附加视图基础数据已更改,它应该刷新自身
通过以下任何变量引用
适配器
ChapterListAdapter adapter = new ChapterListAdapter(context, R.id.lvChapters, this.chapters);
然后设置适配器
pters.setAdapter(adapter);
然后只需调用
adapter.notifyDataSetChanged()代码>将数据添加到本章之后 通过以下任何变量引用适配器
ChapterListAdapter adapter = new ChapterListAdapter(context, R.id.lvChapters, this.chapters);
然后设置适配器
pters.setAdapter(adapter);
然后只需调用adapter.notifyDataSetChanged()代码>将数据添加到本章之后 这是什么?我的适配器类只有构造函数和getView方法。查看它的代码仍然很有用。它扩展了什么适配器类型?它是什么?我的适配器类只有构造函数和getView方法。查看它的代码仍然很有用。它扩展了什么适配器类型?