繁体   English   中英

警报对话框前面的Android显示进度对话框

[英]Android display progress dialog in front of alert dialog

我的AsyncTask进度对话框出现问题。 这是场景。 我有一个带有警报对话框的应用程序,然后检查数据库中的内容。 如果结果为true,则将调用AsyncTask,其中显示进度对话框。 进度对话框显示在警报对话框的后面。 如何在警报对话框前面显示进度对话框?

AsyncTask:

protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(ReadBibleActivity.this);
        pDialog.setMessage(getResources().getString(R.string.translating_bible_version));
        pDialog.setIndeterminate(true);
        pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        pDialog.setCancelable(false);
        pDialog.show();
    }

警报对话框:

private void displayDialog() {
    customDialog = new Dialog(this);
    customDialog.setTitle(getResources().getString(R.string.share));
    customDialog.setContentView(R.layout.dialog);

    etTitle = (EditText) customDialog.findViewById(R.id.etTitle);
    etDescription = (EditText) customDialog.findViewById(R.id.etDescription);

    if(caller == 1) {

        String userVersion = dbHelper.getUserVersion(userId);

        if((userVersion != null && !userVersion.isEmpty())
                && !userVersion.equalsIgnoreCase("TLC")) {

            if(ConnectionDetector.hasNetworkConnection(this)) {
                scrapeTask = new ScrapeAsyncTask();
                scrapeTask.execute();
            } else {
                Toast.makeText(this,
                        getResources().getString(R.string.no_internet_connection),
                        Toast.LENGTH_SHORT).show();
            }

        } else {
            etTitle.setKeyListener(null);
            etTitle.setText(verse);
            etDescription.setText("\"" + text + "\"");
            etDescription.requestFocus();
        }

    } else {
        etTitle.setHint(text);
        etTitle.requestFocus();
        etDescription.setHint(text);
    }

    customDialog.show();
}

有任何想法吗? 帮助将不胜感激。 谢谢!

尝试调用customDialog.show();

scrapeTask = new ScrapeAsyncTask();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM