我在UserDatabse
的领域中从Activity "A"
删除了一个条目,当我在删除后测试UserDatabase
的大小时,它返回" 1" ,然后我开始Activity B
,然后执行以下行:
Realm realm = Realm.getDefaultInstance();
final RealmResults<UserDatabase> stdList = realm.where(UserDatabase.class).findAll();
Log.i("datatesthello","student databse size"+stdList.size());
我收到此错误:java.lang.IllegalStateException:
09-08 16:18:21.491 8517-9711/com.gurkhatech.hamroschool.guardian E/AndroidRuntime: FATAL EXCEPTION: Thread-1712
Process: com.gurkhatech.hamroschool.guardian, PID: 8517
java.lang.IllegalStateException: Requested table is not in this Realm. Creating it requires a transaction: class_UserDatabase
at io.realm.internal.Group.getTable(Group.java:193)
at io.realm.RealmSchema.getTable(RealmSchema.java:230)
at io.realm.RealmSchema.getSchemaForClass(RealmSchema.java:250)
at io.realm.RealmQuery.<init>(RealmQuery.java:139)
at io.realm.RealmQuery.createQuery(RealmQuery.java:88)
at io.realm.Realm.where(Realm.java:1050)
at com.gurkhatech.hamroschool.guardian.SplashActivity.validLogin(SplashActivity.java:81)
at com.gurkhatech.hamroschool.guardian.SplashActivity.access$000(SplashActivity.java:20)
at com.gurkhatech.hamroschool.guardian.SplashActivity$1.run(SplashActivity.java:37)
此外,...活动B中UserDatabase的大小为&#34; 0&#34;当我在日志中打印时。