當前位置: 首頁>>代碼示例>>Java>>正文


Java Realm.init方法代碼示例

本文整理匯總了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);
}
 
開發者ID:AppHero2,項目名稱:Raffler-Android,代碼行數:27,代碼來源:AppApplication.java

示例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);
}
 
開發者ID:playmoweb,項目名稱:store2realm,代碼行數:16,代碼來源:ExampleApplication.java

示例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);
}
 
開發者ID:attiqrehman1991,項目名稱:AndroidRepositoryWithOfflineMode,代碼行數:14,代碼來源:RepositoryApplication.java

示例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());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:App.java

示例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;
}
 
開發者ID:Elbehiry,項目名稱:Pc-Control,代碼行數:36,代碼來源:ConnectionFragment.java

示例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();

}
 
開發者ID:PacktPublishing,項目名稱:Android-Wear-Projects,代碼行數:11,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:chickendude,項目名稱:GlossikaSchedule,代碼行數:13,代碼來源:MainApplication.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:TableIndexAndDistinctTest.java

示例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();
}
 
開發者ID:schul-cloud,項目名稱:schulcloud-mobile-android,代碼行數:10,代碼來源:ApplicationModule.java

示例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));
}
 
開發者ID:TryGhost,項目名稱:Ghost-Android,代碼行數:12,代碼來源:SpectreApplication.java

示例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);
}
 
開發者ID:DorianScholz,項目名稱:OpenLibre,代碼行數:9,代碼來源:ReadingDataTest.java

示例12: before

import io.realm.Realm; //導入方法依賴的package包/類
@Override
protected void before() throws Throwable {
    super.before();
    Realm.init(InstrumentationRegistry.getTargetContext());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:TestRealmConfigurationFactory.java

示例13: onCreate

import io.realm.Realm; //導入方法依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();
    Realm.init(this);
}
 
開發者ID:micromasterandroid,項目名稱:androidadvanced,代碼行數:6,代碼來源:MyApplication.java

示例14: setUp

import io.realm.Realm; //導入方法依賴的package包/類
@Before
public void setUp() {
    Realm.init(InstrumentationRegistry.getTargetContext());
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:RealmLogTests.java

示例15: initializeRealm

import io.realm.Realm; //導入方法依賴的package包/類
private void initializeRealm() {
    Realm.init(this);
    RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build();
    Realm.setDefaultConfiguration(realmConfiguration);
}
 
開發者ID:Laaidback,項目名稱:A.scribe,代碼行數:6,代碼來源:App.java


注:本文中的io.realm.Realm.init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。