I am looking for a way to get size of a custom dialog. I went through this question, but the only answer given is pretty useless, because if I try mDialog.getWindow().
In case, if you have your own XML layouts for custom dialog.
/* whatever you want here */
In activity:
final Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.popup_gameover);
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface d) {
View view = dialog.findViewById(R.id.dialog_main_layout);
int width = view.getWidth();
int height = view.getHeight();
...
}
});
This width and height exacly as expected.