Thanks for sharing the solution.... On Oct 26, 8:30 pm, akurni <a...@kurniadi.org> wrote: > I fixed it by changing > mTitle = ((EditText) > findViewById(R.id.title_edit)).getText().toString(); > to > mTitle = ((EditText) > textEntryView.findViewById(R.id.title_edit)).getText().toString(); > > thanks for all your help > > On Oct 26, 12:58 am, akurni <a...@kurniadi.org> 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 > > anAlertDialog > > LayoutInflater factory = LayoutInflater.from(this); > > final View textEntryView = > > factory.inflate(R.layout.dialog_title_edit, null); > > return newAlertDialog.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 fromEditTextcalled 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 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 -~----------~----~----~----~------~----~------~--~---