Jason Van Anden wrote:
> I am having a problem using AlertDialog for input text.
> 
> Code follows ... everything appears on screen as it should until I click
> OK - then I get a force close.
> 
> I get a null error on line where Editable e = et.getText();.
> 
> Second set of eyes and a sturdy brain appreciated...
> 
> 
> 
>     private void enter_search(){
>        
>         LayoutInflater factory = LayoutInflater.from(this);
>         final View textEntryView =
> factory.inflate(R.layout.search_dialog, null);
>        
>         new AlertDialog.Builder(Peeps.this)
>        
>              //.setIcon(R.drawable.alert_dialog_icon)
>             .setTitle(R.string.search_dialog_text_entry)
>             .setView(textEntryView)
>             .setPositiveButton(R.string.search_dialog_ok, new
> DialogInterface.OnClickListener() {
>                
>                 public void onClick(DialogInterface dialog, int
> whichButton) {
>                    
>                     EditText et =
> (EditText)findViewById(R.id.search_edit);   // !!! apparently I am doing
> this wrong!

I am assuming R.id.search_edit is a field in the textEntryView you
supplied to the builder.

In that case, try textEntryView.findViewById(R.id.search_edit).

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 In Print!

--~--~---------~--~----~------------~-------~--~----~
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