Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Dialog not send content to the EditText ListView

andre.luiz1987andre.luiz1987 BRMember ✭✭
edited April 2013 in Xamarin.Android

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;
       }
}

Posts

  • JonathanPryorJonathanPryor USXamarin Team Xamurai

    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?

  • andre.luiz1987andre.luiz1987 BRMember ✭✭

    Thanks, resolved!

Sign In or Register to comment.