I have inside onCreate method code like this
AlertDialog.Builder builder = new AlertDialog.Builder(
Ex.this);
builder.setMessage(
getResources().getString(R.string.title))
.setPositiveButton(
getResources().getString(R.string.ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
}
})
.setNegativeButton(
getResources().getString(R.string.Cancel),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
}
}).create().show();
but I get leaked window error always. Can anybody tell me what is wrong ? I tried to replace Ex.this with getApplicationContext() but that didn't help.