E.g.
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setView(someView);
AlertDialog dialog = builder.create();
dialog.show();
... then later ...
dialog.setView(someOtherView);
Code executes with no error, but view is not replaced in the dialog. Am I doing it wrong or is this not possible?
I think the alert dialog builder does not build the alert dialog in the conventional way in order to be compatible with all version of android so you will need to update the content view.
Dialog.setContentView(View view)
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setView(view);
AlertDialog alertDialog = builder.create();
alertDialog.show();
then later
alertDialog.setContentView(newView);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setView(view);
AlertDialog alertDialog = builder.create();
alertDialog.show();
then later
alertDialog.dismiss();
AlertDialog.Builder updatedBuilder = new AlertDialog.Builder(context);
updatedBuilder.setView(updatedView);
AlertDialog updatedAlertDialog = builder.create();
updatedAlertDialog.show();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With