インターネット経由でいくつかのものをアップロードしている間、進行状況バーを表示するはずの AsyncTask があります。魅力的に機能することもあれば、進行状況バーが表示されないこともあります。コードは次のとおりです。
public class Upload extends AsyncTask<Void, Void, Void> {
    private ProgressDialog dialog = new ProgressDialog(Activity.this);
    protected void onPreExecute() {
        dialog = ProgressDialog.show(Activity.this, "wait...", "", true, true);
    }
    @Override
    protected Void doInBackground(Void... params) {
        //upload stuff
        return null;
    }
    protected void onPostExecute(Void result) {
        try {
            if (dialog.isShowing())
                dialog.dismiss();
            dialog = null;
        } catch (Exception e) {
            // nothing
        }
        Intent next = new Intent(getApplicationContext(), SecondActivity.class);
        startActivity(next);
        }
    }
}
doInBackground と onPostExecute は常に機能し、時には完全に魅力的に機能することもあります。ただし、アップロード中に進行状況バーが表示されないことがあります。これは競合状態ですか?そうは思いませんが、説明が見つかりません。