[英]Custom CursorAdapter to bind to simple_list_item_checked
For example, say I have a SQLite database of todos, each with a string title and an integer completed. 例如,假设我有一个待办事项的SQLite数据库,每个数据库都有一个字符串标题和一个完整的整数。 How can I create a custom adapter (that extends CursorAdaper) that can bind the checkbox in an
android.R.layout.simple_list_item_checked
to the integer completed? 如何创建自定义适配器(扩展了CursorAdaper)以将
android.R.layout.simple_list_item_checked
的复选框绑定到已完成的整数? I already know I have to convert the integer to a boolean, I'm using true = 1 and false = 0. 我已经知道我必须将整数转换为布尔值,我使用的是true = 1和false = 0。
Please override the bindView abstract Method in your Adapter. 请在您的适配器中重写bindView抽象方法。
/**
* Bind an existing view to the data pointed to by cursor
* @param view Existing view, returned earlier by newView
* @param context Interface to application's global information
* @param cursor The cursor from which to get the data. The cursor is already
* moved to the correct position.
*/
public abstract void bindView(View view, Context context, Cursor cursor);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.