Android:定制化CursorAdapter,简洁版
来源:互联网 发布:淘宝男装外贸 编辑:程序博客网 时间:2024/06/04 19:25
转自:http://blog.cluepusher.dk/2009/11/16/creating-a-custom-cursoradapter-for-android/
I’ve been writing a bit more Android code, and came upon the need to write a custom CursorAdapter for aListView, as the way I wanted to display data from a Cursor was dependent on relationships between different fields of the database.
Of the problems I encountered, the most obvious was when I tried to inflate views using View.inflate(), and found I would get the following error:
After a bit of rummaging around, I found that the following bit of code would work when attached to a ListView using setAdapter().
The above example code doesn’t actually require a CursorAdapter, it would easily be implemented using aSimpleCursorAdapter, but it serves to show the idea. Basicly, get a LayoutInflater from the context, and use the version of inflate() that does not attach to the root view.
Tags: Android, Java
- Android:定制化CursorAdapter,简洁版
- Android CursorAdapter
- Android 使用自定义cursorAdapter
- Android之CursorAdapter用法
- 【android】使用CursorAdapter注意事项
- Android之CursorAdapter示例
- Android适配器之CursorAdapter
- Android之CursorAdapter用法
- Android之CursorAdapter用法
- Android之CursorAdapter用法
- Android CursorAdapter的使用
- Android之CursorAdapter用法
- Android中的CursorAdapter
- Android之CursorAdapter用法
- Android使用之CursorAdapter
- CursorAdapter
- CursorAdapter
- CursorAdapter
- 初识JPA外键关联:指向外部表的主键
- 重现unladen-swallow的性能对比实验
- 你有多强大?
- hdu-4466-Triangle 数学题
- 编程工具的回忆
- Android:定制化CursorAdapter,简洁版
- sublime text2 插件 - ctags的使用
- 10719 - Quotient Polynomial
- DM8148 nand 启动文件
- 工作第一天
- Linux 无法修改/etc/fstab内容 (去除fstab文件只读属性)
- Fab CEO:我在创办4家公司中学到的90件事
- MySQL 数据类型
- Linux Kernel Panic报错解决思路