SQLへのいくつかの注入を行っています。それはそれほど時間はかかりませんが、アプリケーションがデータを注入している間はプログレスバーが必要です。Android: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.
}
別のスレッドでaddInjectionを試してください。私の推測では、メインスレッドがUIを更新するのをブロックしているということです。 – Vjy