当前位置: 首页>>代码示例>>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;未经允许,请勿转载。