So I'm doing this thing after user gets back to my activity from a payment service:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Bundle metadata = getMetadata();
if (metadata == null || requestCode != metadata.getInt(REQ_CODE)) {
return;
}
if (resultCode == RESULT_OK) {
EventBus.getDefault().post(new PaymentResult(data, true));
} else {
EventBus.getDefault().post(new PaymentResult(data, false));
}
}
In the method subscribing to PaymentResult
I'm showing a dialog fragment (or rather - I'm trying to show a dialog fragment):
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPaymentResult(PaymentResult result) {
String message;
if (result.getStatus()) {
message = "ok";
} else {
message = "baaaad";
}
DialogFragment newFragment = NotificationFragment.newInstance(message);
newFragment.show(((AppCompatActivity)mContext).getSupportFragmentManager(), "notification");
}
But I'm hitting this exception. How to overcome this?