Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android进度条不显示_Android_Firebase_Firebase Realtime Database - Fatal编程技术网

Android进度条不显示

Android进度条不显示,android,firebase,firebase-realtime-database,Android,Firebase,Firebase Realtime Database,我使用firebase发布某个日期,我需要在上传数据时使用进度对话框指示用户。我导入进度对话框,我需要在上传前显示它,并在上传后关闭它。但是,“进度”对话框根本不会出现 谁能告诉我哪里出错了,谢谢 private ProgressDialog progressDialog; progressDialog = new ProgressDialog(this); public void postHelp() { progressDialog.setMessage("Posting yo

我使用firebase发布某个日期,我需要在上传数据时使用进度对话框指示用户。我导入进度对话框,我需要在上传前显示它,并在上传后关闭它。但是,“进度”对话框根本不会出现

谁能告诉我哪里出错了,谢谢

private ProgressDialog progressDialog;
progressDialog = new ProgressDialog(this);


public void postHelp() {

    progressDialog.setMessage("Posting your request...");
    progressDialog.show();

    final String postTitle = title.getText().toString().trim();
    final String postDesc = desc.getText().toString().trim();
    final String postAddress = address.getText().toString().trim();
    final String postPhone = phone.getText().toString().trim();

    //check input fields
    if (!TextUtils.isEmpty(postTitle) && !TextUtils.isEmpty(postDesc)
            && !TextUtils.isEmpty(postAddress) && !TextUtils.isEmpty(postPhone)) {

        final DatabaseReference newRequest = database.push();
        mDatabaseUser.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {

                newRequest.child("Title").setValue(postTitle);
                newRequest.child("Desc").setValue(postDesc);
                newRequest.child("Address").setValue(postAddress);
                newRequest.child("Phone").setValue(postPhone);
                progressDialog.dismiss();
            }

            @Override
            public void onCancelled(DatabaseError databaseError) {
            }
        });
        Intent main = (new Intent(AddPostActivity.this,MainActivity.class));
        main.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(main);
    }
}

调用对话框生成器,如下所示:

AlertDialog.Builder diaog = new AlertDialog.Builder(this,android.R.style.Theme_DeviceDefault_Dialog)
            .setTitle(title)
            .setMessage(message)
            .setPositiveButton(okBtn, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {

                }
            })
            .setCancelable(false)
            ;
然后


@MarcGV您可以在android o中找到它。Opost完整的代码…您在活动中在哪里使用
这个
dialog.show();
dialog.dismiss();