Widget - ProgressDialog (Horizontal)

final ProgressDialog progressDoalog = new ProgressDialog(this);

final Handler handle = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
progressDoalog.incrementProgressBy(1);
}
};
progressDoalog.setMax(100);
progressDoalog.setMessage("Its loading....");
progressDoalog.setTitle("ProgressDialog bar example");
progressDoalog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDoalog.show();
new Thread(new Runnable() {
@Override public void run() {
try {
while (progressDoalog.getProgress() <= progressDoalog.getMax()) {
Thread.sleep(200);
handle.sendMessage(handle.obtainMessage());
if (progressDoalog.getProgress() == progressDoalog.getMax()) {
progressDoalog.dismiss();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();

Komentar

Cara pembuatan Apps paling Populer

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

Codes for modifying Action Bar in Sketchware

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Firebase Login/Register with email verification