show full screen popup in android

Solutions on MaxInterview for show full screen popup in android by the best coders in the world

showing results for - "show full screen popup in android"
Gaia
28 Aug 2020
1Rect displayRectangle = new Rect();
2Window window = MainActivity.this.getWindow();
3window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
4final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this,R.style.CustomAlertDialog);
5ViewGroup viewGroup = findViewById(android.R.id.content);
6View dialogView = LayoutInflater.from(v.getContext()).inflate(R.layout.customview, viewGroup, false);
7dialogView.setMinimumWidth((int)(displayRectangle.width() * 1f));
8dialogView.setMinimumHeight((int)(displayRectangle.height() * 1f));
9builder.setView(dialogView);
10final AlertDialog alertDialog = builder.create();
11Button buttonOk=dialogView.findViewById(R.id.buttonOk);
12buttonOk.setOnClickListener(new View.OnClickListener() {
13   @Override
14   public void onClick(View v) {
15      alertDialog.dismiss();
16   }
17});
18alertDialog.show();