android - Add new item in the Listview is already populate the start of app -


Using the My ListView ListFragment and BaseAdapter, there is a population at the beginning of the application. In the layout I have a button to add a new item, but when I add a new item to the list items item it is removed.

My inventor Cs:

  Public Category TabItems: List Fraudmat {Adaptitum _ Adaptador; View public override octivity (layoutinfile inflator, view group container, bundle saved instenstate) {see View = Inflator. Inflight (resource layout, items, empty); See list view list = (list view) view. FundwidiId (Android.Resource.Id.ListItems); _Adaptador = new adapter (this activity, webservice, return list items); ListView.Adapter = _Adaptador; Return view; } Public Override Zero OnListItemClick (ListView L, See V, Int Position, Long ID) {Bundle Bundle = New Bundle (); Intent Activity = New Intent (v. Contestex, Typef (ChatActivivity)); Int value = (int) l.Adapter.GetItem (status); Bundle Point ("value", value); Activity.PutExtras (bundle); StartActivity (activity); }}  

My activity.cs

  list & lt; String & gt; _List = new list & lt; String & gt; (); ArrayAdapter & LT; String & gt; _Adapter; List view_listview; Protected override zero overcrit (bundle bundle) {base.OnCreate (bundle); SetContentView (Resource.Layout.TelaChat); UtilPop.CreateListViewWithItems (); // Start _ListView = FindViewById & lt; ListView & gt; Populate the list view in (resource.ind.listItems); ImageButton BTNADIT = SearchVVID & lt; Image button & gt; (Resource.ind.botideitem); BtnAddItem.Click + = btnAddItem_Click; } Zero btnAddItem_Click (object sender, EventArgs e) {edit text edttxItem = FindViewById & lt; EditedText> (resource.ind.itname); AddItem (edttxMensagem.Text); } // listview Add new items to Private Zero AddItem (string itemName) {_List.Add (itemName); _Adapter = New Arrayheader & lt; String & gt; (This, Android. Resource layout, Simple list item 1, list); _ListView.Adapter = _Adapter; _ListView.DeferNotifyDataSetChanged (); }  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -