locked
Dialog not send content to the EditText ListView RRS feed

  • Question

  • User7235 posted

    I have a problem.

    I have a dialog that has an EditText. The contents of this EditText I caught and put in a ListView, the error is that my variable that receives the contents of the EditText only receives null. move contents of dialog for the listview was to be quiet

    code:

    {
          ImageView btnAddLinha = (ImageView) objDialogAddNewLine.FindViewById(Resource.Id.btok);
          ImageView btnCancelar =(ImageView)objDialogAddNewLine.FindViewById(Resource.Id.btcancel);
    
          btnAddLinha.Click + = delegate
          {
             EditText txtNomedaLinha = FindViewById<EditText> (Resource.Id.txtNomedaLinha); <-- txtNomeLinha receive NULL?? Why???
    
                 Item_ListView newItem = new Item_ListView (txtNomedaLinha.Text);
                 items.add (newItem);
                 adapterListView AdapterListView = new (this, items);
                 adapterListView.NotifyDataSetChanged ();
                 MainList.Adapter = adapterListView;
           }
    }
    
    Sunday, April 28, 2013 8:04 PM

All replies

  • User48 posted

    As a guess, you should try using objDialogAddNewLine.FindViewById<EditText>(Resource.Id.txtNomedaLinha), not just FindViewById<EditText>(Resource.Id.txtNomedaLinha).

    Alternatively, presumably you're using SetContentView() in your code. Does the layout you're using contain a txtNomedaLinha id?

    Sunday, April 28, 2013 8:30 PM
  • User7235 posted

    Thanks, resolved!

    Sunday, April 28, 2013 8:41 PM