我有一个自定义对话框,它是由下面的代码创建的:
public DialogFragment CreateNewPostedMessageDialog(CardSwipeData data,
List<MessagesMap> messagesMap,
string fbProfileimageAsByteString,
Context context) {
DialogFragment newFragment =
new NewPostedMessageDialogFragment(data, messagesMap,
fbProfileimageAsByteString,
context);
return newFragment;
}
它是从我的 Activity 的 OnResume RunOnUiThread 调用的:
ThreadPool.QueueUserWorkItem(state => {
// Processing stuff here
RunOnUiThread(() => {
DialogFragment dialog = CreateNewPostedMessageDialog(cardSwipeData,
messagesMap, bitmapByteString, this);
dialog.Show(FragmentManager, "PostedMessage");
// ListAdapter gets updated here
Thread.Sleep(3000);
dialog.Dismiss();
});
});
我想在 3 秒后关闭我的对话框,但发生的情况是我的对话框从未出现,但我的列表在 3 秒后仍会更新。我在睡眠方面做错了什么?