当前位置: 首页>>代码示例>>Java>>正文


Java Realm.setDefaultConfiguration方法代码示例

本文整理汇总了Java中io.realm.Realm.setDefaultConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java Realm.setDefaultConfiguration方法的具体用法?Java Realm.setDefaultConfiguration怎么用?Java Realm.setDefaultConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.realm.Realm的用法示例。


在下文中一共展示了Realm.setDefaultConfiguration方法的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();
    random = new Random();
    xkcdMapper = new XkcdMapper();
    executor = Executors.newSingleThreadExecutor();
    Realm.init(this);
    RealmConfiguration realmConfiguration = new RealmConfiguration.Builder() //
            .deleteRealmIfMigrationNeeded() //
            .build();
    Realm.setDefaultConfiguration(realmConfiguration);
    retrofit = new Retrofit.Builder().baseUrl("http://xkcd.com/")
            .addConverterFactory(LoganSquareConverterFactory.create())
            .build();
    xkcdService = retrofit.create(XkcdService.class);
}
 
开发者ID:Zhuinden,项目名称:xkcd-example,代码行数:17,代码来源:CustomApplication.java

示例3: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    application = this;

    Nammu.init(this);

    /*
     * Configure Realm
     */
    Realm.init(this);
    RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
            .deleteRealmIfMigrationNeeded()
            .build();

    Realm.setDefaultConfiguration(realmConfiguration);

    try {
        DataStore.getInstance();
    } catch (RealmError e) {
        Log.e(TAG, "Error configuring realm, deleting and trying again.", e);

        Realm.deleteRealm(realmConfiguration);
        DataStore.getInstance();
    }
}
 
开发者ID:KwalaGroup,项目名称:Android-Client,代码行数:27,代码来源:KwalaApplication.java

示例4: Realm

import io.realm.Realm; //导入方法依赖的package包/类
public static Realm Realm() {
    if(realm == null){
        // Create a RealmConfiguration that saves the Realm file in the app's "files" directory.
        Realm.init(getAppContext());
        RealmConfiguration realmConfig = new RealmConfiguration.Builder()
                .deleteRealmIfMigrationNeeded()
                .build();
        Realm.setDefaultConfiguration(realmConfig);

        // Get a Realm instance for this thread
        realm = Realm.getDefaultInstance();

        realm.addChangeListener(new RealmChangeListener<Realm>() {
            @Override
            public void onChange(Realm element) {
                Log.d(Tag,"app realmOnChangeListener");
            }
        });
    }

    return realm;
}
 
开发者ID:jamesddube,项目名称:LaravelNewsApp,代码行数:23,代码来源:App.java

示例5: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    cluttr=this;
    Colorful.defaults().translucent(true);
    Colorful.init(this);
    ExtSdHelper.init();
    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    newRelease = !(BuildConfig.VERSION_CODE == prefs.getInt("current_version",0));

    Realm.init(this);
    RealmConfiguration config = new RealmConfiguration.Builder()
            .deleteRealmIfMigrationNeeded()
            .directory(getCacheDir())
            .build();
    Realm.setDefaultConfiguration(config);
}
 
开发者ID:garretyoder,项目名称:Cluttr,代码行数:18,代码来源:Cluttr.java

示例6: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    mContext = getApplicationContext();

    Realm.init(this);
    RealmConfiguration config = new RealmConfiguration.Builder()
            .deleteRealmIfMigrationNeeded()
            .build();
    Realm.setDefaultConfiguration(config);
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:12,代码来源:MyApplication.java

示例7: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Realm.init(this);
    RealmConfiguration.Builder config = new RealmConfiguration.Builder()
            .name("kutuk.realm")
            .schemaVersion(SCHEMA_VERSION);
    if (BuildConfig.DEBUG) {
        config.deleteRealmIfMigrationNeeded();
    } else {
        config.migration(new Migration());
    }
    Realm.setDefaultConfiguration(config.build());
}
 
开发者ID:SeriousBug,项目名称:Kutuk,代码行数:15,代码来源:KutukApp.java

示例8: initDefaultRealm

import io.realm.Realm; //导入方法依赖的package包/类
public static void initDefaultRealm(@NonNull String dbSuffix, int version, RealmMigration realmMigration) {
        Realm.removeDefaultConfiguration();
        RealmConfiguration.Builder builder = new RealmConfiguration.Builder()
                .name("db_realm_" + dbSuffix)
                .schemaVersion(version)
                .rxFactory(new RealmObservableFactory());
//                .deleteRealmIfMigrationNeeded();
        if (realmMigration != null)
            builder.migration(realmMigration);

        RealmConfiguration realmConfiguration = builder.build();
        Realm.setDefaultConfiguration(realmConfiguration);
    }
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:14,代码来源:DBManager.java

示例9: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Realm.init(this);
    RealmConfiguration configuration = new RealmConfiguration.Builder().deleteRealmIfMigrationNeeded().build();
    Realm.setDefaultConfiguration(configuration);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:MyApplication.java

示例10: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    context = this;

    initializeTimber();
    RxJavaPlugins.setErrorHandler(throwable -> Timber.e(throwable.toString()));

    // Configure default configuration for Realm
    Realm.init(this);
    RealmConfiguration realmConfig = new RealmConfiguration.Builder().build();
    Realm.setDefaultConfiguration(realmConfig);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:NewsReaderApplication.java

示例11: RealmSingleton

import io.realm.Realm; //导入方法依赖的package包/类
private RealmSingleton() {
    try {
        realm = Realm.getDefaultInstance();
    } catch (Exception e) {
        RealmConfiguration config = new RealmConfiguration.Builder(App.getAppContext())
                .name("tmsdb.realm")
                .schemaVersion(REALM_SCHEMA_VERSION)
                .migration(new MyRealmMigration())
                .build();
        Realm.setDefaultConfiguration(config);
        realm = Realm.getDefaultInstance();
    }
}
 
开发者ID:chashmeetsingh,项目名称:TrackIt-Android,代码行数:14,代码来源:RealmSingleton.java

示例12: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();

        //kode konfirmasi Realm
        RealmConfiguration config = new RealmConfiguration.Builder()
//                .deleteRealmIfMigrationNeeded()
//                .build();
                .schemaVersion(0)
                .migration(new DataMigration())
                .build();
        Realm.setDefaultConfiguration(config);
    }
 
开发者ID:setakarim,项目名称:ingetin,代码行数:14,代码来源:BaseApp.java

示例13: initDatabase

import io.realm.Realm; //导入方法依赖的package包/类
private void initDatabase() {

		Realm.init(BikeDeBoaApplication.this);
		RealmConfiguration configuration = new RealmConfiguration.Builder()
				.deleteRealmIfMigrationNeeded()
				.build();
		Realm.setDefaultConfiguration(configuration);
	}
 
开发者ID:EduardoVernier,项目名称:bikedeboa-android,代码行数:9,代码来源:BikeDeBoaApplication.java

示例14: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
public void onCreate() {
    super.onCreate();
    Realm.init(this);

    config = new RealmConfiguration.Builder().name("posts").deleteRealmIfMigrationNeeded().build();
    Realm.setDefaultConfiguration(config);
}
 
开发者ID:ccrama,项目名称:Slide-RSS,代码行数:8,代码来源:BaseApplication.java

示例15: onCreate

import io.realm.Realm; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);

    setTitle("Realm.io Examples");

    ArrayList<ContentItem> objects = new ArrayList<ContentItem>();

    objects.add(new ContentItem("Line Chart", "Creating a LineChart with Realm.io database"));
    objects.add(new ContentItem("Bar Chart",
            "Creating a BarChart with Realm.io database"));
    objects.add(new ContentItem("Horizontal Bar Chart",
            "Creating a HorizontalBarChart with Realm.io database"));
    objects.add(new ContentItem("Scatter Chart",
            "Creating a ScatterChart with Realm.io database"));
    objects.add(new ContentItem("Candle Stick Chart", "Creating a CandleStickChart with Realm.io database"));
    objects.add(new ContentItem("Bubble Chart", "Creating a BubbleChart with Realm.io database"));
    objects.add(new ContentItem("Pie Chart", "Creating a PieChart with Realm.io database"));
    objects.add(new ContentItem("Radar Chart", "Creating a RadarChart with Realm.io database"));
    objects.add(new ContentItem("Realm Wiki", "This is the code related to the wiki entry about realm.io on the MPAndroidChart github page."));

    MyAdapter adapter = new MyAdapter(this, objects);

    ListView lv = (ListView) findViewById(R.id.listView1);
    lv.setAdapter(adapter);

    lv.setOnItemClickListener(this);

    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();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:RealmMainActivity.java


注:本文中的io.realm.Realm.setDefaultConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。