I am showing a countdown while Realm dataBase is loaded from the asset file
SharedPreferences wmbPreference = PreferenceManager.getDefaultSharedPreferences(this);
boolean isFirstRun = wmbPreference.getBoolean("FIRSTRUN", true);
if (isFirstRun)
{
handler = new Handler();
Runnable r = new Runnable() {
public void run() {
Intent intent=new Intent(context,FirstRun.class);
startActivity(intent);
}
};
handler.post(r);
RealmConfiguration config = new RealmConfiguration.Builder(context)
.name(Realm.DEFAULT_REALM_NAME)
.migration(new in.webic.longevity.longevity.Word())
.assetFile(context, "Default.realm")
.schemaVersion(0)
.build();
realm = realm.getInstance(config);
realm.close();
SharedPreferences.Editor editor = wmbPreference.edit();
editor.putBoolean("FIRSTRUN", false);
editor.commit();
}
Problem:
countdown should be show, rather a blank screen while asset file is copying as default database
Yet activity starts after few seconds(which is in the thread) taken by the code below to load the asset file,
Is there a better way to show countdown while Realm configuration is setup.
any help would be appreciated
Thanks