Android SugarORM 试图保存一条记录,成功了,但它看起来像是卡在了一些 look

Android SugarORM Tried to save a record, successfull, but it looks like it was stuck in some look

我是 SugarORM 的新手,我尝试保存一条记录。

Report report = new Report(SessionManager.getInstance().getUserid(),
                           assessmentContainer.getAssessmentTitle(),
                           getDateTimeNow(), response);
report.save();

在SugarORM给出的quick guide中,好像包含了context,但是我不知道怎么包含我的context,和我的Report构造函数有点冲突,所以我省略了。

貌似成功了,但是好像效率不高。知道出了什么问题吗?看看下面我的日志。

02-01 14:10:32.736      903-903/com.usrs.jiarong.musrs I/Sugar﹕ on create
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.136      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.146      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.156      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ domain class
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ create table
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs D/Sugar﹕ Fetching properties
02-01 14:10:33.166      903-903/com.usrs.jiarong.musrs I/Sugar﹕ creating table REPORT
02-01 14:10:33.176      903-903/com.usrs.jiarong.musrs I/Sugar﹕ Report saved : 1
02-01 14:10:33.196      903-903/com.usrs.jiarong.musrs I/Choreographer﹕ Skipped 30 frames!  The application may be doing too much work on its main thread.

在第一次启动 sugarorm 时,它必须为数据库生成模型。确保您使用所需的表格将 DOMAIN_PACKAGE_NAME 指定到您的包中。

在您的应用 build.gradle

中编辑编译版本

compile 'com.github.satyan:sugar:1.5'

并且在模型中仅使用 SugarRecord

扩展

我已经用这个方法修复了。