我正在对sql进行一些注射,首次启动时大约有一百次。它不需要那么长时间,但我想要一个进度条,而应用程序正在注入数据。
这是我的代码,但不会出现进度条,只有黑屏。
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
boolean firstStart = settings.getBoolean("firstStart", true);
if(firstStart) {
ProgressDialog dialog = ProgressDialog.show(myInject.this, "", "Please wait.", true);
addInjection("The quick brown fox"); // about a hundred of these injections
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("firstStart", false);
editor.commit();
dialog.dismiss(); //if i remove this i can see the progress dialog but wont close.
}