Hi,
Try as below.
public void onClick(DialogInterface dialog, int whichButton) {
AlertDialog ad = (AlertDialog) dialog;
EditText editUsername = (EditText) ad.findViewById
(R.id.username_edit);
EditText editPassword = (EditText)
ad.findViewById (R.id.password_edit);
EditText editMail = (EditText) ad.findViewById
(R.id.email_edit);
}
Regards
On Jan 16, 2:29 am, Dominik <[email protected]> wrote:
> hello
>
> I have an Activity class in which I have this method which returns an
> AlertDialog:
>
> protected Dialog onCreateDialog(int id) {
> switch (id) {
> case 0:
> (returns an alert.......)
> case 1:
> LayoutInflater factory = LayoutInflater.from(this);
> final View textEntryView = factory.inflate
> (R.layout.register_member, null);
> return new AlertDialog.Builder(CheatView.this).setIcon
> (R.drawable.alert_dialog_icon)
> .setTitle(R.string.register_title)
> .setView(textEntryView).setPositiveButton(R.string.ok,
> new DialogInterface.OnClickListener() {
> public void onClick(DialogInterface
> dialog, int whichButton) {
>
> EditText editUsername = (EditText) findViewById(R.id.username_edit);
> EditText editPassword
> = (EditText) findViewById
> (R.id.password_edit);
> EditText editMail =
> (EditText) findViewById(R.id.email_edit);
>
> }
> }).setNegativeButton(R.string.cancel, new
> DialogInterface.OnClickListener() {
> public void onClick(DialogInterface dialog, int
> whichButton) {
>
> /* User clicked cancel so do some stuff */
> }
> }).create();
> }
> return null;
> }
>
> when the user presses OK I want to grab the information he entered in
> that AlertDialog EditText field (i.e. editUsername ) - my problem is
> that I always get NULL values. after pressing the OK button the
> application crashes. Does anyone have an idea what I am doing wrong?
>
> thanks for help!
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en