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();
精彩评论