Oooh, I tried to follow this explanation: http://developer.android.com/intl/de/guide/topics/ui/dialogs.html#CustomDialog
if anyone wants to have a look at it! On Feb 9, 10:24 pm, André <pha...@hotmail.com> wrote: > Hello, > > I'm trying to make a dialog box to open when I start a program. > Eclipse likes my code, I like my code =), but the emulator does not > like my code. It says that something went totally worong and the > application has to shut down. Bellow you can see my code. When I run > it in debug mode everything seems to go as it should but when it gets > to "return dialog; " eclipse debug windows says source not found. > Anyone have any suggestions? > > regards > André > > package com.test.popup; > > import android.app.Activity; > import android.app.Dialog; > import android.content.Context; > import android.os.Bundle; > import android.widget.TextView; > > public class popup extends Activity { > static final int DIALOG_NEW = 0; > static final int DIALOG_NEW2 = 1; > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > showDialog(DIALOG_NEW2); > } > protected Dialog onCreateDialog(int id) { > Context mContext = getApplicationContext(); > Dialog dialog = new Dialog(mContext); > switch(id) { > case DIALOG_NEW: > dialog.setContentView(R.layout.popup_new); > dialog.setTitle("Custom Dialog"); > > TextView text = (TextView) dialog.findViewById(R.id.text); > text.setText("Hello, this is a custom dialog!"); > break; > case DIALOG_NEW2: > dialog.setContentView(R.layout.popup_new); > dialog.setTitle("Custom Dialog"); > > TextView text2 = (TextView) dialog.findViewById(R.id.text); > text2.setText("Hello, this is a custom dialog!2"); > break; > default: > dialog = null; > } > return dialog; > } > > > > } -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en