本文整理汇总了Java中io.realm.Realm.init方法的典型用法代码示例。如果您正苦于以下问题:Java Realm.init方法的具体用法?Java Realm.init怎么用?Java Realm.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.realm.Realm
的用法示例。
在下文中一共展示了Realm.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
//.schemaVersion(2) // Must be bumped when the schema changes
//.migration(new RealmContactMigration()) // Migration to run instead of throwing an exception
.name("default.realm").build();
Realm.setDefaultConfiguration(config);
if(database==null) {
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
FirebaseDatabase.getInstance().setLogLevel(Logger.Level.DEBUG);
}
database = FirebaseDatabase.getInstance();
References.init(this, database);
AppManager.getInstance().setContext(getApplicationContext());
AppManager.getInstance().setCountry(Country.getCountryFromSIM(getApplicationContext()));
// Initialize image loader
initImageLoader(this);
}
示例2: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mApplicationComponent = DaggerApplicationComponent.builder()
.applicationModule(new ApplicationModule(this))
.build();
mApplicationComponent.inject(this);
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(config);
}
示例3: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
}
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder().build();
Realm.setDefaultConfiguration(config);
}
示例4: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@TimeLog
public void onCreate() {
super.onCreate();
mApp = this;
Realm.init(this);
SpUtil.init(this);
AppCompatDelegate.setDefaultNightMode(SpUtil.isNight() ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO);
store = new Stack<>();
registerActivityLifecycleCallbacks(new SwitchBackgroundCallbacks());
}
示例5: onCreateView
import io.realm.Realm; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_con,container,false);
preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
mEditor = preferences.edit();
mConnection = new Connection();
Realm.init(getActivity());
realm = Realm.getInstance(getRealmConfig());
connections = realm
.where(Connection.class)
.findAllSorted("name", Sort.ASCENDING);
//recycler view
connection_list = (RealmRecyclerView) rootView.findViewById(R.id.realm_recycler_view);
mAdapter = new Connection_Adapter(getActivity(),connections,false,false);
mAdapter.setListiner(this);
connection_list.setAdapter(mAdapter);
//add button
add = (FloatingActionButton) getActivity().findViewById(R.id.add_new_conn);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showAddDialog();
}
});
return rootView;
}
示例6: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
configLayoutComponents();
Realm.init(this);
realm = Realm.getDefaultInstance();
}
示例7: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
// initialize Realm
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder()
.name("glossikaschedule.realm")
.schemaVersion(1)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(config);
}
示例8: setUp
import io.realm.Realm; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Realm.init(InstrumentationRegistry.getInstrumentation().getContext());
config = configFactory.createConfiguration();
sharedRealm = OsSharedRealm.getInstance(config);
sharedRealm.beginTransaction();
}
示例9: provideRealmConfiguration
import io.realm.Realm; //导入方法依赖的package包/类
@Provides
@Singleton
RealmConfiguration provideRealmConfiguration(@ApplicationContext Context context) {
Realm.init(context);
RealmConfiguration.Builder builder = new RealmConfiguration.Builder().
deleteRealmIfMigrationNeeded();
builder.name("default.realm");
return builder.build();
}
示例10: setupMetadataRealm
import io.realm.Realm; //导入方法依赖的package包/类
private void setupMetadataRealm() {
final int METADATA_DB_SCHEMA_VERSION = 4;
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder()
.modules(new BlogMetadataModule())
.schemaVersion(METADATA_DB_SCHEMA_VERSION)
.migration(new BlogMetadataDBMigration())
.build();
Realm.setDefaultConfiguration(config);
AnalyticsService.logMetadataDbSchemaVersion(String.valueOf(METADATA_DB_SCHEMA_VERSION));
}
示例11: setUp
import io.realm.Realm; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
Realm.init(context);
setupRealm(context);
realmRawData = Realm.getInstance(realmConfigRawData);
}
示例12: before
import io.realm.Realm; //导入方法依赖的package包/类
@Override
protected void before() throws Throwable {
super.before();
Realm.init(InstrumentationRegistry.getTargetContext());
}
示例13: onCreate
import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Realm.init(this);
}
示例14: setUp
import io.realm.Realm; //导入方法依赖的package包/类
@Before
public void setUp() {
Realm.init(InstrumentationRegistry.getTargetContext());
}
示例15: initializeRealm
import io.realm.Realm; //导入方法依赖的package包/类
private void initializeRealm() {
Realm.init(this);
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build();
Realm.setDefaultConfiguration(realmConfiguration);
}