-1
我转换CSV文件到文件的境界上APP ONE然后在APP运送此作为主数据库中的两个和设置为使用应用中包含default.realm文件还没有“无默认RealmConfiguration被发现了。电话setDefaultConfiguration()第一个”
SharedPreferences wmbPreference = PreferenceManager.getDefaultSharedPreferences(this);
boolean isFirstRun = wmbPreference.getBoolean("FIRSTRUN", true);
if (isFirstRun)
{
RealmConfiguration config = new RealmConfiguration.Builder(context)
.name(Realm.DEFAULT_REALM_NAME)
.migration(new in.webic.oralcalculations.Row())
.assetFile(context, "Default.realm")
.schemaVersion(0)
.build();
realm = realm.getInstance(config);
realm.close();
SharedPreferences.Editor editor = wmbPreference.edit();
editor.putBoolean("FIRSTRUN", false);
editor.commit();
}
和default.realm默认数据库在我的另一项活动保存在app目录
我试图通过
使用此数据库public void prepare_test(int id){
realm = realm.getDefaultInstance();
RealmResults<RowNew> result2 = realm.where(RowNew.class)
.equalTo("course", id)
.findAll();
String a="";
for (RowNew u : result2) {
a+=" "+u.getQp1();
}
Toast.makeText(this,a,
Toast.LENGTH_LONG).show();
}
给我的错误
没有默认RealmConfiguration被发现。呼叫setDefaultConfiguration(第一
),但我已经显示在应用
任何帮助将appritiated
感谢