Saturday, October 22, 2011

[android-developers] Re: Custom Dialog Not Showing

I got it working. I don't know exactly what fixed it, but I think it's
because I was declaring the Button variables within the class rather
than within the function that creates/defines the dialog.

For example:

public class Foo {

Button x, y;

private Dialog addPCDialog {

private Dialog addPCDialog()
{
final Dialog dialog = new Dialog( this );

dialog.setContentView( R.layout.party_createpc );
dialog.setTitle( "Add PC" );

x = ( Button ) dialog.findViewById( R.id.createPCDone );
y = ( Button ) dialog.findViewById( R.id.createPCCancel );
}

When I changed to this it started working:

private Dialog addPCDialog()
{
final Dialog dialog = new Dialog( this );

dialog.setContentView( R.layout.party_createpc );
dialog.setTitle( "Add PC" );

Button x = ( Button ) dialog.findViewById( R.id.createPCDone );
Button y = ( Button ) dialog.findViewById( R.id.createPCCancel );
}

On Oct 22, 6:54 pm, TreKing <treking...@gmail.com> wrote:
> On Sat, Oct 22, 2011 at 8:52 PM, Alex Oh <alexo...@gmail.com> wrote:
> > I wonder if it has anything to do with the way my xml file is being layed
> > out. I just tested this and it works. The xml file is just a simple
> > LinearLayout w/a text view.
>
> Post it.
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment