I want to show an ExpandableList in a Dialog. Is it possible to do so ? If yes then how ? Please help me out.
4 Answers
yes this is possible Create custom dialog and add expandable list in it's layout
and good tutorial for custom dialog is here

- 1,459
- 14
- 19
Should work try this:
Dialog d = new Dialog(this);
TextView test = new TextView(this);
test.setText("test");
d.setContentView(test);
d.show();
Should work with more complex views defined by you:
LayoutInflater l = this.getLayoutInflater();
View v = l.inflate(R.id.yourView, false);
d.setContentView(v);
d.show();

- 57
- 10
-
thanks john, but i tried something similar. Unfortunately, the list items didn't populate. Hence, i asked the question here. – Utkarsh Mankad Jun 14 '13 at 05:52
-
showing the activity as dialog would be a simpler and effective solution here. – Utkarsh Mankad Jun 14 '13 at 05:56
Is it possible to create an expandable list AlertDialog?
this link is also helpful for your problem it displays expendable list view in the dialog but to reduce the complexity you can create a activity with the expendable list view and show that activity as the dialog it would make it much more simpler
this is helpful in displating your activity as dialog.

- 1
- 1

- 2,595
- 2
- 22
- 37
-
Hi, I had seen the link which you've referred. But i guess, showing the activity as dialog would be a simpler option. Also, I am moving to other activity when an item is clicked. Thanks a lot for your help. – Utkarsh Mankad Jun 14 '13 at 05:55
There are many ways to implement this. One easiest way that I always prefer for customized dialogs is,
Build up your UI and corresponding java coding as a usual Activity. Then in manifest, specify its theme as a dialog.
<activity android:theme="@android:style/Theme.Dialog"
android:name="ClassName"></activity>

- 5,698
- 9
- 45
- 57