Issue
I want to display the error dialog box returned from api, on handler result but I get nothing while trying to display. I would help on displaying this error
@Override
public void onError(Throwable e) {
TicketScanActivity.this.dialogProgress.dismiss();
showValidErrorDialog(getApplicationContext());
Log.d("onError", e.toString());
}
this is the show method I am calling to display message
private void showValidErrorDialog(Context context)
{
new MaterialDialog.Builder(context)
.title(R.string.dialog_error)
.content(R.string.unsuccessful_validation)
.positiveText(R.string.dialog_positive)
.show();
}
Solution
You cannot use getApplicationContext() to show a dialog box.
Dialog is owned by his activity. Use the current activity context instead using the application context.
Try use this, TicketScanActivity.this, getContext() or getActivity(). It will depend where you are building the dialog box.
Answered By - GuilhermeFGL
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.