i m updating the progress of a progressbar in a side thread and displaying the progressbar by posting a runnable using handler the is defined in the MainActivity class(UI Thread)
but still i am getting the error....!!!
please help????
the following code is inside the "public void run()" method of a class that has implemented the Runnable interface.
for (int i = 0; i < 11; ++i) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
final int x = i;
Runnable r2 = new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
pb.setProgress(x * 10);
}
};
handler.post(r2);
}