@SuppressWarnings("ButterKnifeInjectNotCalled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; ArrayList<ContentItem> objects = new ArrayList<>(); objects.add( new ContentItem(getString(R.string.realm_ci_0_name), getString(R.string.realm_ci_0_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_1_name), getString(R.string.realm_ci_1_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_2_name), getString(R.string.realm_ci_2_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_3_name), getString(R.string.realm_ci_3_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_4_name), getString(R.string.realm_ci_4_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_5_name), getString(R.string.realm_ci_5_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_6_name), getString(R.string.realm_ci_6_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_7_name), getString(R.string.realm_ci_7_desc))); objects.add( new ContentItem(getString(R.string.realm_ci_8_name), getString(R.string.realm_ci_8_desc))); MyAdapter adapter = new MyAdapter(this, objects); lv.setAdapter(adapter); View footer = LayoutInflater.from(this).inflate(R.layout.tip_end, null); lv.addFooterView(footer); Realm.init(this); // Create a RealmConfiguration that saves the Realm file in the app's "files" directory. RealmConfiguration realmConfig = new RealmConfiguration.Builder().build(); Realm.setDefaultConfiguration(realmConfig); Realm realm = Realm.getDefaultInstance(); realm.beginTransaction(); realm.deleteAll(); realm.commitTransaction(); }
@Override public void onCreate() { super.onCreate(); // Initialize Realm. Should only be done once when the application starts. Realm.init(this); }