You need a way to notify your foreground Activity that the operation is complete, you can do this by registering a listener, since you have not posted any code, I will make assumptions.
There are two ways you can notify a foreground Activity that I know of, the first way is using broadcast intents, there is a question here relating to them Android BroadcastReceiver within Activity. You can fire of a broadcast intent from your background operation and register your activity as a receiver.
See here http://developer.android.com/reference/android/content/Context.html#sendOrderedBroadcast%28android.content.Intent,%20java.lang.String,%20android.content.BroadcastReceiver,%20android.os.Handler,%20int,%20java.lang.String,%20android.os.Bundle%29 and here
http://developer.android.com/reference/android/content/BroadcastReceiver.html
The second way is to register a listener with your class that performs the background operation, for instance (pseudo code)
@Override
protected void onResume() {
BackgroundOperator.registerListener(this);
}
@Override
protected void onPause() {
BackgroundOperator.unregisterListener(this);
}
public void onOperationComplete(...) {
// TODO: Show your dialog here
}
Where your listener could be something like this (which your Activity could implement):
interface BackgroundOperatorListener {
void onOperationComplete(...);
}
The idea here is your foreground activity will be the current registered listener, so it will be the recipient of the onOperationComplete(...) callback, and you can then show your dialog, the ... could be any number of arguments to pass to your activity when the operation is complete.