I'm trying to show a spinning progress dialog until my activity calls the method finish(). I call progressDialog.show() right before I call finish(). I can see the spinner, but it is not spinning...any suggestions?
I tried to put the finish() and the stuff which gets called in onActivityResult() of the other activity in background threads, so the ui-thread shouldn't have to do something. When I'm debugging and I wait at the finish() method on another thread than the main thread, the progress dialog is spinning...when I go one step further and call the finish() method, the progress dialog stops spinning and after 1-2 seconds the activity disappears.
So my only suggestion is that the finish() method is the reason for the not moving progress dialog...is there a possibility to get it moving?
Thanks in advance!
Edit: That code is inside activity A which gets finished.
private void goBack() {
setResult((mReopen) ? Constants.RESULT_REOPEN : RESULT_OK);
if (mReopen) {
mProgressDialog.show();
}
new Thread(new Runnable() {
@Override
public void run() {
finish();
}
}).start();
}
That code is inside the activity B which starts activity A.
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
if (requestCode == Constants.REQUEST_CODE_OPEN_EMAG) {
new Thread(new Runnable() {
@Override
public void run() {
switch (resultCode) {
case Constants.RESULT_REOPEN:
mReopen = true;
openEmag(mLastOpenedEmagId, false, false);
break;
default:
mReopen = false;
break;
}
}
}).start();
}
}
As you can see all the stuff gets called in different threads than the ui-thread.