I want to put a ProgressDialog on my program while calculating something.I tried many things but any of them helps me.Here is my code ;
dialog=ProgressDialog.show(this, "calculating", "Please wait while the calculation is getting done.",true);
this.runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
changeHelp = 0;
if(screenNumber == 1){
compareImages(3.3, 0.12);
}
else if(screenNumber==2 || screenNumber == 4){
compareImages(1.4, 0.1);
}
else if ( screenNumber == 3)
compareImages(0.41, 0.1);
else
compareImages(3.3, 0.0676);
dialog.dismiss();
screenNumber++; }
});
There are a lot of question in there about this problem.Although ı tried many of them,ı couldn't deal with the problem.I don't want to use asynctask.Pls help me .
----EDİT----
I have added thread.sleep(2000) in try but it is still not working.I think that ı am doing something wrong in while putting dialog.dismiss but ı couldn't find where the problem is?