i got a problem in updating progress bar. I am updating progress bar in separate Thread and the variable on which the progressbar progress is depending(which is a class variable
Try this.
declare this variable at Global.
int delay = 100;
int period = 2000;
Following function call where you need it.
public void setProgressbar()
{
progressBar = new ProgressDialog(context);
progressBar.setCancelable(true);
progressBar.setMessage("File downloading ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
final Handler mhandler = new Handler();
final Runnable mRunnable = new Runnable() {
@Override
public void run() {
progressBar.setProgress(progress);
progress++;
}
};
final Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
mhandler.post(mRunnable);
}
}, delay, period);
}