Sunday, 5 October 2014

Android: ListView inside an AlertDialog

In this tutorial we show how to create a list inside an alert dialog.

The items of the list are defined in the class 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

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

You can download the complete example from our repository: Download

The final result is the following:

1 comment:

  1. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving... very specific nice content.Android Training in chennai | Android Training