Don't call dismiss() in onLoadFinished().
It's prohibited. Instead use a Handler to delay-call it. Bug 3173317 Change-Id: Ic5ef245a65b3a4eeebabcebd6323b9a7921f34d5
This commit is contained in:
parent
dc8f1afeb6
commit
8197d84734
@ -34,6 +34,7 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Loader;
|
import android.content.Loader;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
|
|
||||||
@ -141,6 +142,21 @@ public class MoveMessageToDialog extends DialogFragment implements DialogInterfa
|
|||||||
return (Callback) getActivity();
|
return (Callback) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delay-call {@link #dismiss()} using a {@link Handler}. Calling {@link #dismiss()} from
|
||||||
|
* {@link LoaderManager.LoaderCallbacks#onLoadFinished} is not allowed, so we use it instead.
|
||||||
|
*/
|
||||||
|
private void dismissAsync() {
|
||||||
|
new Handler().post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!mDestroyed) {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader callback for {@link MessageChecker}
|
* Loader callback for {@link MessageChecker}
|
||||||
*/
|
*/
|
||||||
@ -157,7 +173,8 @@ public class MoveMessageToDialog extends DialogFragment implements DialogInterfa
|
|||||||
}
|
}
|
||||||
// accountId shouldn't be null, but I'm paranoia.
|
// accountId shouldn't be null, but I'm paranoia.
|
||||||
if ((accountId == null) || (accountId == -1)) {
|
if ((accountId == null) || (accountId == -1)) {
|
||||||
dismiss(); // Some of the messages can't be moved.
|
// Some of the messages can't be moved. Close the dialog.
|
||||||
|
dismissAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mAccountId = accountId;
|
mAccountId = accountId;
|
||||||
|
Loading…
Reference in New Issue
Block a user