Skip to content Skip to sidebar Skip to footer

Android Custom List Dialog

Could someone point out a working example of a custom dialog that takes an ArrayAdapter as input and shows a selectable list. I have tried to create a Dialog using an AlertDialog B

Solution 1:

Indeed AlertDialog is implements Facade design pattern with this class behind : http://www.netmite.com/android/mydroid/frameworks/base/core/java/com/android/internal/app/AlertController.java

And the whole code is such a mess... I took 3 hours to try to do that, and I am going to build a dialog from scratch, using android.R.layout as a basis.

Steff

Solution 2:

You have to make a call to

invalidateViews()

on your listview - that will cause it to redraw the view with the updates.

Solution 3:

Since you are using onPrepareDialog(int id, Dialog dialog), I am guessing you're initially setting up the dialog in onCreateDialog(int id).

Doing so cause the system to save the dialog you initially create. In order to achieve the desired functionality, when the dialog is dismissed, tell the system to discard it by calling android.app.Activity.removeDialog(int id).

Any subsequent invocations will have your dialog regenerated through the onCreateDialog(int id) method, causing the set of items to be updated.

Post a Comment for "Android Custom List Dialog"