本文整理匯總了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);
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
示例13: initDatabase
import io.realm.Realm; //導入方法依賴的package包/類
private void initDatabase() {
Realm.init(BikeDeBoaApplication.this);
RealmConfiguration configuration = new RealmConfiguration.Builder()
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(configuration);
}
示例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);
}
示例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();
}