編輯:關於Android編程
在默認情況下,在android下默認只打印info級別的日志信息,所以在默認情況只能打印ormlite中創建數據庫表的語句,而對於數據的插入和查詢等sql語句是不會打印出來的。在ormlite中提供了 AndroidLog類來設置adb log的級別。因為我們需要打印出更多的sql語句,這樣方便我們進行調試。
官網上是這樣說明的:
The ormlite-android.jar classes de ne the AndroidLog class which is the Android
speci c version of ORMLite logging. This class makes calls to the Log.d, Log.i, . . .
methods in the Android API. To see the log output, you will need to use the adb utility to
view the log output:
adb logcat
Since INFO is the default under Android, only message such as the following will be spit
out by default:
I/TableUtils( 254): creating table 'simpledata'
I/TableUtils( 254): creating index 'simpledata_string_idx' for table
'simpledata
I/TableUtils( 254): executed create table statement changed 1 rows:
CREATE TABLE `simpledata` (`date` VARCHAR, `id` INTEGER PRIMARY
KEY AUTOINCREMENT , `even` SMALLINT )
I/TableUtils( 254): executed create table statement changed 1 rows:
CREATE INDEX `simpledata_string_idx` ON `simpledata` ( `string` )
To enable more debug information you will want to do something like the following to
turn on logging for a particular class:
adb shell setprop log.tag.StatementExecutor VERBOSE
adb shell setprop log.tag.BaseMappedStatement VERBOSE
adb shell setprop log.tag.MappedCreate VERBOSE
This enables messages such as:
D/BaseMappedStatement(465): create object using 'INSERT INTO `simpledata`
(`date` ,`string` ,`millis` ,`even` ) VALUES (?,?,?,?)' and 4 args,
changed 1 rows
D/BaseMappedStatement(465): assigned id '9' from keyholder to 'id' in
SimpleData object
To enable all debug messages for all ORMLite classes then use the following:
adb shell setprop log.tag.ORMLite DEBUG
NOTE: Unfortunately, Android property names are limited in size so the ORMLite logger
only takes that last 23 [sic] characters of the class name if it is larger than 23 characters.
For example, if the class is AndroidDatabaseConnection you would do:
adb shell setprop log.tag.droidDatabaseConnection VERBOSE
If you are trying to track operations performed to the database by ORMLite use:
adb shell setprop log.tag.droidDatabaseConnection VERBOSE
adb shell setprop log.tag.ndroidCompiledStatement VERBOSE
也就是說要在後台打印輸出更多的日志信息,在項目啟動的過程中在adb控制台輸入:adb shell setprop log.tag.ORMLite DEBUG即可解決
在android開發中會碰到有頂部導航並且下面顯示的內容是一個listview,此時要想實現左右滑動切換頂部導航的選項是不能實現的,因為listview自己消耗橫向滑動事
Android 動畫(anim)詳解 就我所知,簡單闡述一下: Android的animation由四種類型組成:alpha(透明度)、scale(縮放)、transl
自己寫db文件方法有兩種:1、用sql server2005+sqlserver2sqlite_converter工具(數據在sql server裡面寫)2、用Excel
華為mate9和mate9 pro的區別 華為mate9介紹 新一代旗艦芯片 華為麒麟960 HUAWEI Mate 9搭載的麒麟960芯片, 八核C