Android Adapter,UI界面更新
来源:互联网 发布:手机淘宝客软件 编辑:程序博客网 时间:2024/05/02 21:50
Android Adapter,UI界面更新方法:
(广播处理器,普通方法onstart()和onresume(),handler中更新UI)
1:广播处理器
MusicPlayerActivity:
ArrayList<Music> musics = new MusicBiz(MusicPlayerActivity.this).getLocalMusics(); app.setMusics(musics);// 更新共享的播放列表数据,更新数据. adapter.changeDataSet(musics);// 更新界面
MusicAdapter:
public void setMusics(ArrayList<Music> musics) { if (musics != null) this.musics = musics; else this.musics = new ArrayList<Music>(); } public void changeDataSet(ArrayList<Music> musics) { this.setMusics(musics); this.notifyDataSetChanged(); }
2:普通方法onstart()和onresume()
StuMainActivity:
protected void onResume() { String order = pref.getString("pref_key_sort_col", "_id"); adapter.changeDataSet(biz.getStudents(order)); }
StudentAdapter:
public void setStudents(ArrayList<Student> students) { if (students != null) this.students = students; else this.students = new ArrayList<Student>(); }public void changeDataSet(ArrayList<Student> students) { this.setStudents(students); this.notifyDataSetChanged(); }
3:handler中更新UI
FSPointActivity handler中:
ckb = (CustomKeywordsBean) msg.obj; keywords = ckb.getKeywords(); adapter.dateChanged(keywords);
PointsAdapter:
public void setKeywords(ArrayList<CustomKeyword> keywords) { if (keywords != null) { this.keywords = keywords; } else { this.keywords = new ArrayList<CustomKeyword>(); } }public void dateChanged(ArrayList<CustomKeyword> keywords) { this.setKeywords(keywords); this.notifyDataSetChanged(); }
0 0
- Android Adapter,UI界面更新
- android异步更新UI界面
- android线程更新UI界面
- Android UI界面更新之Handler
- android异步更新UI界面的方法
- android关于UI界面更新的问题
- android handler实现界面UI的更新
- Android 子线程 更新 UI 界面 总结
- Android 中几种更新UI界面的方法
- Android总结Handler异步更新UI界面
- Android 子线程更新UI界面
- Android在子线程更新UI界面
- Android中用Handler更新界面UI
- Android非UI线程中更新UI界面
- Android UI之Adapter
- UI界面的更新
- Android界面开发-Adapter
- Android adapter局部更新
- js 和ajax 提交给服务器端的代码, 验证输入值符不符合,验证服务器传递过来的值 thinkphp
- Go实战--go语言中执行shell脚本(The way to go)
- Servlet知识点
- 强化学习进阶 第七讲 TRPO
- java中四种引用类型(对象的强、软、弱和虚引用)
- Android Adapter,UI界面更新
- C++实现简单的走迷宫
- CodeForces 625 D.Finals in arithmetic(构造)
- bootstrap编写响应式页面
- 对象2
- 修改linux下当前用户的编码方式,以zh_CN.gbk为例
- 浮动布局
- Android service和IntentService使用
- JavaWeb编码处理——EncodingFilter