In this tutorial we show how to create a list inside an alert dialog.
The items of the list are defined in the class Component.java and are made of a title and a subtitle.
When the application is started, it's created an Arraylist with 3 elements of this type.
The main activity is implemented in MainActivity.java:
The layout of the alert dialog is defined in list_dialog.xml:
The layout of the single item of the list is defined in component.xml:
The adapter for the correspondence between the layout and the list is defined in ComponentAdapter.java:
You can download the complete example from our repository: Download ListDialog.zip
The final result is the following: