Saturday, October 22, 2011

[android-developers] Re: Custom Dialog Not Showing

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.

public class TestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button testBtn = ( Button ) findViewById( R.id.testButton );
testBtn.setOnClickListener(
new View.OnClickListener() {

@Override
public void onClick(View v)
{
showDialog( 0 );
}
});
}

protected Dialog onCreateDialog( int id )
{
Dialog dialog;

switch ( id )
{
case 0:
dialog = new Dialog( this );
dialog.setTitle( "DIAG TEST" );
break;
default:
dialog = null;
}
return dialog;
}
}

On Oct 22, 4:25 pm, TreKing <treking...@gmail.com> wrote:
> On Sat, Oct 22, 2011 at 4:57 PM, Alex Oh <alexo...@gmail.com> wrote:
> > Yes. There are no crashes at all from after showDialog, switch
> > statements are being executed correctly, etc. dialog within
> > onCreateDialog is being assigned an id, not null.
>
> And nothing at all in the LogCat?
> Barring that, try to simplify the problem down - don't set a custom view for
> example and set some basic text in the dialog and see if that works. Also
> try using an AlertDialog and its Builder class and see if that makes a
> difference.
>
> -------------------------------------------------------------------------------------------------
> 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