Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/224.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android自动刷新列表视图项_Android_Listview - Fatal编程技术网

android自动刷新列表视图项

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

首先,我设置一个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 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方法。查看它的代码仍然很有用。它扩展了什么适配器类型?