How to implement a custom AlertDialog View

Posted by stormin986 on Stack Overflow See other posts from Stack Overflow or by stormin986
Published on 2010-05-08T19:14:40Z Indexed on 2010/05/08 19:18 UTC
Read the original article Hit count: 998

Filed under:
|

In the Android docs on AlertDialog, it gives the following instruction and example for setting a custom view in an AlertDialog:

If you want to display a more complex view, look up the FrameLayout called "body" and add your view to it:

FrameLayout fl = (FrameLayout) findViewById(R.id.body);
fl.add(myView, new LayoutParams(FILL_PARENT, WRAP_CONTENT));

First off, it's pretty obvious that add() is a typo and is meant to be addView().

I'm confused by the first line using R.id.body. It seems that it's the body element of the AlertDialog ... but I can't just enter that in my code b/c it gives a compile error. Where does R.id.body get defined or assigned or whatever?

© Stack Overflow or respective owner

Related posts about android

Related posts about alertdialog