如题,book2为表名 class为列名,sp为一个spinner传来的string值,方法用button直接点击实现,我想让查询的结果显示在activity的一个listview上
public void Query(){
String table = "book2" ;
String selection = "class=?" ;
String[] selectionArgs = new String[]{ "sp" };
Cursor c = sqliteDatabase.query(table, null, selection, selectionArgs, null, null, null, null );
c.moveToFirst();
list.invalidateViews();
c.close();
}
报错为nosuchmathodexception 不知道怎么改,求大神教我
public void Query(){
String table = "book2" ;
String selection = "class=?" ;
String[] selectionArgs = new String[]{ "sp" };
Cursor c = sqliteDatabase.query(table, null, selection, selectionArgs, null, null, null, null );
c.moveToFirst();
list.invalidateViews();
c.close();
}
报错为nosuchmathodexception 不知道怎么改,求大神教我
解决方案 »
- 新手求教,买什么东西来练习安卓相关的开发
- ICS4.0 QuickSearchBox清除快捷方式的bug,有人知道怎么解吗?
- xml问题
- 强烈建议Android专栏分为应用开发和源码开发两个部分
- 下拉框问题
- An internal error occurred during: "Android SDK Content Loader".大虾们帮帮忙!!
- 重写OnCreateOptionMenu用PopupWindow代替 能打开但是点第二下无法关闭 求大神指教啊
- 内容缩放!!!!!!!!!!
- Eclipse 里报 did you mean to use @+id instead of @+android:id?
- android httpProxy 混淆后无法捕获 自定义异常
- android studio创建AVD是出现Unknown error
- 创建多选菜单,写setMultiChoiceItems出现问题,如图说不存在该方法
//Cursor c = queryTheCursor( startID, uid, fid);
String s="SELECT * FROM tb_friendmsg where "
+" ( ( _to="+uid+" and send="+fid+" ) or ( _to="+fid+" and send="+uid+" )) "
+"order by id desc limit "+loadcount+" offset 0 ";
Cursor c = db.rawQuery(s, null);
while (c.moveToNext()) {
ChatMsgEntity person = new ChatMsgEntity();
person.id = c.getInt(c.getColumnIndex("id"));
person.send = c.getInt(c.getColumnIndex("send"));
person._to=c.getInt(c.getColumnIndex("_to"));
person.createTime = c.getString(c.getColumnIndex("createTime"));
person.content = c.getString(c.getColumnIndex("content"));
persons.add(person);
}
c.close();
return persons;][/code]
参考方法。