这有点令人毛骨悚然 - 首先插入的数据总是丢失.
我做什么 - 我总是丢失我的第一笔交易细节.类似地,如下所示我添加两次交易 - 但是当我得到交易表的返回结果的大小时,它总是1 - 而不是2.
如果我做错了,请告诉我?
提前致谢
我正在添加如下交易:
transactionHelper th = new transactionHelper(this.activity.getApplicationContext());
values.clear();
values = new ContentValues();
values.put("accountid", accountID );
values.put("amount", totalBalance);
values.put("transactiontype", 1);
values.put("checknumber", "");
values.put("checkdate", transactionDate);
values.put("cleared", 1);
values.put("notes", "Starting Balance");
values.put("categoryid", startCat);
boolean added = th.addTransaction(values);
Log.v("jv", "Is this added or not: " + added);
th.addTransaction(values);
Log.v("jv", "nothing added: " + th.getAll().size());
Run Code Online (Sandbox Code Playgroud)
我的班级看起来像:
public transactionHelper(Context context) { super(context, DATABASE_NAME , null, 1); }
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(
"CREATE …Run Code Online (Sandbox Code Playgroud)