Hi all,

I am facing a problem for getting text from EditText field which is on
alert dialog same like ApiDemo text entry Dialog

public void enterNumberView(Activity activity){

                    LayoutInflater factory = LayoutInflater.from
(activity);
                    final View textEntryView = factory.inflate
(R.layout.invite_friend_enternumber, null);
                    new AlertDialog.Builder(activity)
                        .setIcon(R.drawable.invite_friends_icon)
                        .setTitle("Enter Numbers")
                        .setView(textEntryView)
                        .setPositiveButton("Invite", new
DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface
dialog, int
whichButton) {

                                EditText enterNumberField = (EditText)
findViewById(R.id.username_edit);

                                String numbers =
enterNumberField.getText
().toString();

                                Log.i("Enter Number Field Text",
""+numbers);

                            }
                        })
                        .setNegativeButton("Cancel", new
DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface
dialog, int
whichButton) {

                                /* User clicked cancel so do some
stuff */
                            }
                        })
                        .show();
               }

*********************************************************xml is
under*********************
<EditText
        android:id="@+id/username_edit"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:scrollHorizontally="true"
        android:numeric="integer"
        android:digits="0123456789,"
        android:autoText="false"
        android:capitalize="none"
        android:gravity="fill_horizontal"
        android:textAppearance="?android:attr/textAppearanceMedium" />
************************************************************************************

i have also found the an answer of this post as under

You are doing the findViewById() on the *activity*, not the dialog.
Call findViewById() on the dialog's content instead. BY (Romain Guy)
****************************************************************************
any one can help How Call findViewById() on the dialog's content
please modify in my code snipt where i am wrong
i dont know the exact syntex or way to Call findViewById() on the
dialog's
content.

Thanks and Regards,
Gulfam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to