So I\'ve activity called GameActivity.java and in this activity I call DialogAnswer.show() which simple shows some picture on screen.
using try catch may not be a efficient way to solve this problem as may cause memory leak; for this question, as the context is used as param, so before using the code dialog.dismiss, we can use codes below to protect:
public void onFinish() {
if{ctx instanceof Activity && !((Activity)ctx.isfinishing()){
dialog.dismiss(); //this is line 36
}
}
also, another method can be used to patch this crash in the function of onDestroy() in the activity, add the code:
protected void onDestroy() {
if(dialog != null){
dialog.dismiss();
dialog = null;
}
}