摘要:
用Intent启动另一个Activity的方法: private void showSettings() { final Intent intent = new Intent(this,SettingsActivity.class); startActivity(intent); } 调用showSettings函数即可启用SettingsActivity。另外,广播是不需要intent来启动的。直接在BroadcastReceiver里面用getAction()函数来接收广播就行了(不要忘了注册),别的Activity里面不用写任何东西。比... 阅读全文
posted @ 2013-11-18 20:17
LarryLawrence
阅读(197)
评论(0)
推荐(0)
摘要:
在用SQLiteDatabase的时候如果碰到说database或者cursor没有关闭,可以在使用完之后加上: if (!cursor.isClosed()) { cursor.close(); } if(db!= null) { db.close();//db是数据库对象 } 阅读全文
posted @ 2013-11-18 20:10
LarryLawrence
阅读(276)
评论(0)
推荐(0)
摘要:
Cursor cursor = db.query(true, "user", new String[]{"id","mode"}, "id=?", new String[]{"1"}, null, null, "1,2", null);cursor.moveToNext();如上,在用数据库的Cursor的moveToNext方法时,出现了题中的报错。经百度,发现这两句需要放在public方法中才行。放入public void onCreate() 方法中之后错误消失。 阅读全文
posted @ 2013-11-18 16:11
LarryLawrence
阅读(1035)
评论(0)
推荐(0)
摘要:
where子句,为什么db.update("user", cva, "id=?", new String[]{"1"});如果填入2就不行,填1才行。 阅读全文
posted @ 2013-11-18 16:02
LarryLawrence
阅读(118)
评论(0)
推荐(0)

浙公网安备 33010602011771号