-1

I need to create a popup window programmatically, with a scrollview is this possible? i need to do everything in java side.

I was using a alert dialog but maybe is better a popup window, but didn't find much information on how to do it programatically.

i was using this code for the alert dialog

  AlertDialog.Builder alert = new AlertDialog.Builder(OFActivityA.this);
        alert.setTitle("Something");
        alert.setText("fe");
        alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                //what you need to do after click "OK"
            }

        });
        alert.show();
545 55
  • 25
  • 4

1 Answers1

0

i need to do everything in java side., not really - you can create your custom dialog with a custom layout and have any kind of layout that you would like to have.

For example, create dialogClass:

public class ProgressDialog extends Dialog {

public ProgressDialog(@NonNull Context context) {
    super(context);

    setContentView(R.layout.progress_dialog); //this is your layout for the dialog

    }
}

And all you need to do to show your dialog is call those line:

ProgressDialog progressDialog = new ProgressDialog(getContext());
progressDialog.show(); // this line shows your dialog

You can put all your logic into the class using java as you want to only that now you can control your layout and how it looks in easier way.

Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53