Android - how to hide / show progressbar onclick

前端 未结 3 780
粉色の甜心
粉色の甜心 2021-01-28 22:52

I am trying to show a progressbar when a button is clicked. When i test the app it force closes / stops. My app works fine before the progressbar code is added in.

also

3条回答
  •  广开言路
    2021-01-28 23:16

                ProgressDialog progressDialog = new ProgressDialog(this);
        progressDialog.setProgressStyle(R.style.NewDialog);
        progressDialog.setMessage("Loading...");
    

    Paste the below in your styles.xml New Dialog :

    
    

    When you want to show you can cuse progressDialog.show() and to hide you can use progressDialog.dismiss().

提交回复
热议问题