How to open Dialog
when phone state is receive. Because whenever a State
is received it results in the following error:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
How can I solve this problem?
Phone State is Idle then i call Dialog. Any help will be appreciated. Here is my code.
final Dialog dialog = new Dialog(mcontext);
dialog.setContentView(R.layout.dialog);
dialog.setTitle("Android Custom Dialog Box");
final EditText et_remark = (EditText) dialog
.findViewById(R.id.et_remark);
Button dialogButton = (Button) dialog
.findViewById(R.id.btn_submit);
dialogButton
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
String remark = et_remark.getText()
.toString();
if (call_duration.equals("0")) {
Toast.makeText(mcontext,
" miss",
Toast.LENGTH_LONG)
.show();
} else {
if (cType.equals("OUTGOING")) {
Toast.makeText(
mcontext,
" out ",
Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(mcontext,
" inc",
Toast.LENGTH_LONG)
.show();
}
}
}
});
dialog.show();