private void addAction() {
String what = mInputWhat.getText().toString();
long now = System.currentTimeMillis();
Realm.init(getContext());
RealmConfiguration configuration = new RealmConfiguration.Builder().build();
Realm.setDefaultConfiguration(configuration);
Realm realm = Realm.getDefaultInstance();
Drop drop = new Drop(what, now, 0, false);
realm.beginTransaction();
realm.copyToRealm(drop);
realm.commitTransaction();
realm.close();
}
}
Here whenever i don't create a contexet the app crashes but when i create a context using Realm.init(getContext()) the "Add it" button don't workenter image description here