自定义进度栏不起作用,应用崩溃

时间:2019-03-08 05:37:36

标签: android progressdialog

当我尝试使用自定义进度条时,它没有显示进度条,并且一段时间后应用程序崩溃了。

代码:

public class RegistrationScreen extends AppCompatActivity implements View.OnClickListener {
    CustomProgressDialog customdialog;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.registration);

    }@Override
    public void onClick(View v) {

        switch (v.getId()) {
        case R.id.register_submit_btn:
            showProgress();
        }

        private void showProgress() {
            customdialog = new CustomProgressDialog(RegistrationScreen.this);
            customdialog.setTitle("Please Wait a Movement...");
            customdialog.setCanceledOnTouchOutside(false);
            customdialog.setCancelable(false);
            customdialog.show();
        }
    }
}

0 个答案:

没有答案