MatrixCursor和MergeCursor
来源:互联网 发布:java应届生杭州工资 编辑:程序博客网 时间:2024/05/21 22:31
1、MatrixCursor创建记录
ContentProvider对外共享数据的时候的query()方法是需要一个cursor的,
但是如果没有数据库,而项目又需要从ContentProvider读取数据的时候怎么办?
更糟糕的是其他方法操作也都是需要cursor的。
此时就需要MatrixCursor了。相当有趣,它相当于为你模拟了一个表。
@Override
public
Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
String[] tableCursor =
new
String[] {
"name"
,
"job"
,
"salary"
};
MatrixCursor cursor =
new
MatrixCursor(tableCursor);
cursor.addRow(
new
Object[] {
"1111"
,
"1111"
,
"1111"
});
return
cursor;
}
2、MergeCursor 记录的合并
Cursor c0 = MailboxList.this.managedQuery( EmailContent.Mailbox.CONTENT_URI, MailboxList.this.mListAdapter.PROJECTION, MAILBOX_SELECTION0, new String[] { String.valueOf(mAccountKey) }, MailboxColumns.TYPE); Cursor c1 = MailboxList.this.managedQuery( EmailContent.Mailbox.CONTENT_URI, MailboxList.this.mListAdapter.PROJECTION, MAILBOX_SELECTION, new String[] { String.valueOf(mAccountKey) }, MailboxColumns.TYPE/* + "," + MailboxColumns.DISPLAY_NAME*/); Cursor c2 = MailboxList.this.managedQuery( EmailContent.Mailbox.CONTENT_URI, MailboxList.this.mListAdapter.PROJECTION, MAILBOX_SELECTION1, new String[] { String.valueOf(mAccountKey) }, MailboxColumns.TYPE/* + "," + MailboxColumns.DISPLAY_NAME*/); Cursor[] cursors = new Cursor[] { c0, c1, c2 }; Cursor c = new MergeCursor(cursors);
- MatrixCursor和MergeCursor
- MatrixCursor和MergeCursor
- Cursor, MergeCursor, MatrixCursor
- Cursor, MergeCursor, MatrixCursor灵活应用
- MatrixCursor
- MatrixCursor
- MatrixCursor和listview的用法
- Android Cursor之MergeCursor
- 合并Cursor之MergeCursor
- Android Cursor之MergeCursor
- Android之MatrixCursor示例
- android MatrixCursor源码解析
- Android 浅谈MatrixCursor
- MatrixCursor 模拟数据库
- 可定制的Cursor--MatrixCursor
- 可定制的Cursor--MatrixCursor
- MergeCursor引起的CursorAdapter更新无效问题
- MatrixCursor 与 AbstractCursor实现Cursor 封装
- 设置IP和代理的Windows Bat脚本
- 云计算的一些基础入门知识
- 创建索引
- linux下的V4L2提取USB摄像头图像(一)
- SQL SERVER 提取表字段名字
- MatrixCursor和MergeCursor
- Android高手进阶教程(十一)之----Android 通用获取Ip的方法(判断手机是否联网的方法)!!!
- 关于C++程序的字符编码问题
- linux 下crontab简单使用
- linux下vi命令大全
- Android高手进阶教程(十二)之----Android 在一个应用中如何启动另外一个已安装的应用!!!
- C中的goto,setjmp使用示例(异常的集中处理)
- jquery.uploadify.js 上传文件控件
- Android 高手进阶教程(十三)之----Android 数据库SQLiteDatabase的使用!!