开发者

How to show progress bar/circle in android

I want to display a progress bar/wheel,开发者_如何学Go when doing some process, for instance, on a button click I want the screen to freeze and show a progress wheel , till the pressed action for example saving data in database is completed.

Is it possible, please provide code if applicable.


In your OnClick(), I think you must use something like this :

 progressDialog = ProgressDialog.show(MyActivity.this,
                    "title","loading..." , true); 


            final Runnable runInUIThread = new Runnable() {
                public void run() {
                              //do some work
                    }
            };

             new Thread() {
                 @Override
                 public void run() {

                        handler.post(runInUIThread);
                    progressDialog.dismiss();

                    }
                }.start();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜