Did you call setContentView before ?

Regards, plusminus
http://anddev.org
#  Worlds largest Android Development Community / Tutorials

On 26 Okt., 03:58, akurni <[EMAIL PROTECTED]> wrote:
> I tried to follow the example in the API demo on custom view inside
> alert dialog.
>
> case DIALOG_EDIT_TITLE:
>                         // This example shows how to add a custom layout to 
> an AlertDialog
>                         LayoutInflater factory = LayoutInflater.from(this);
>                         final View textEntryView =
> factory.inflate(R.layout.dialog_title_edit, null);
>                         return new AlertDialog.Builder(NoteEdit.this)
>                             .setTitle(R.string.menu_edit_title)
>                             .setView(textEntryView)
>                             .setPositiveButton(R.string.alert_dialog_ok, new
> DialogInterface.OnClickListener() {
>                                 public void onClick(DialogInterface dialog, 
> int
> whichButton) {
>                                         mTitle = ((EditText)
> findViewById(R.id.title_edit)).getText().toString();
>                                 }
>                             })
>                             .setNegativeButton(R.string.alert_dialog_cancel, 
> new
> DialogInterface.OnClickListener() {
>                                 public void onClick(DialogInterface dialog, 
> int
> whichButton) {
>
>                                 }
>                             })
>                             .create();
>
> I want to get the user input from EditText called title_edit when the
> user press ok. But it always give me a nullexception. Am I doing
> anything wrong? From looking at the API demo, it seems that it's
> possible to get user input from the dialog box.
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to