本文整理匯總了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);
}