android实现关键字搜索功能
来源:互联网 发布:python opencv人脸识别 编辑:程序博客网 时间:2024/05/17 09:28
//以关键字查找日记为例,主要是Sql语句
public ArrayList<DiaryBean> searchNotes(String keywords) {
if (keywords != null) {
ArrayList<DiaryBean> dList = new ArrayList<DiaryBean>();
//查询日记标题或内容含有关键字的记录
Cursor cusror = mDb.query(true, DATABASE_TABLE, new String[] { ROWID,
TITLE, BODY, CREATED, MOOD, WEATHER, COLOR, BACKGROUND, SIZE },
"TITLE like '%" + keywords + "%'"+" or BODY like '%" + keywords +"%'" , null, null, null, null, null);
while (cusror.moveToNext()) {
DiaryBean bean = new DiaryBean();
bean.setTitle(cusror.getString(cusror.getColumnIndex(TITLE)));
bean.setBody(cusror.getString(cusror.getColumnIndex(BODY)));
bean.setColor(cusror.getInt(cusror.getColumnIndex(COLOR)));
bean.setMood(cusror.getInt(cusror.getColumnIndex(MOOD)));
bean.setId(cusror.getInt(cusror.getColumnIndex(ROWID)));
bean.setTime(cusror.getString(cusror.getColumnIndex(CREATED)));
bean.setWeather(cusror.getInt(cusror.getColumnIndex(WEATHER)));
bean.setSize(cusror.getInt(cusror.getColumnIndex(SIZE)));
bean.setBackground(cusror.getInt(cusror
.getColumnIndex(BACKGROUND)));
dList.add(bean);
}
cusror.close();
return dList;
} else {
return null;
}
- android实现关键字搜索功能
- Android搜索功能实现
- ajax实现搜索提示功能 (关键字自动匹配功能)
- android搜索框功能实现
- android 蓝牙搜索功能实现
- Android搜索功能的实现
- Android实现搜索关键字飞入飞出效果
- Android listView按字母排序,关键字搜索功能
- Android中ListView字母排序,实现字母挤压效果以及右侧快速选中字母,搜索关键字功能
- 实现类似Android联系人搜索功能
- Android之搜索功能的实现
- android 实现 搜索保存历史记录功能
- Android ListView用EditText实现搜索功能
- Android 用EditText实现搜索框功能
- Android开发中搜索功能的实现
- Android搜索实时显示功能实现
- 谓词实现关键字搜索
- Memcache实现搜索关键字
- nm 命令
- linux下查看进程内存使用情况
- js中的eventType事件
- 记录的网址
- iOS学习之UINavigationController详解与使用(三)ToolBar
- android实现关键字搜索功能
- Android设计模式系列--观察者模式
- Cocos2d-x中使用Lua脚本
- http服务器 Nginx配置文件详细说明
- dev gridcontrol控件表头菜单屏;
- Win32-API函数调用的约定
- GreenDroid总结
- 常用正则表达式
- 非常适合android初学者的一个网址