Дайте значение textview внутри listview с помощью кнопки
Привет, у меня есть listview на android, я хочу дать textview значение +1, Когда я нажимаю кнопку.
вот мой код адаптера:
namespace fnb.Adapters { class listMenuAdapters : BaseAdapter<listMenuModels>, IFilterable { private Context mContext; private List<listMenuModels> mItems; private List<listMenuModels> _originalData; private TextView txtNamaMenu; private TextView txtHargaMenu; private ImageView imageMenu; private TextView txtKodeMenu; private TextView txtQty; private ImageButton butPlusMenu; private ImageButton butMinMenu; public listMenuAdapters(Context context, List<listMenuModels> items) { this.mItems = items; this.mContext = context; Filter = new MenuFilter(this); } public override int Count { get { return mItems.Count; } } public override listMenuModels this[int position] { get { return mItems[position]; } } public override long GetItemId(int position) { return position; } public override View GetView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { row = LayoutInflater.From(mContext).Inflate(Resource.Layout.lvListMenuFnb_rowItem, null, false); } txtNamaMenu = row.FindViewById<TextView>(Resource.Id.textMenuName); txtNamaMenu.Text = mItems[position].namaMenu; txtHargaMenu = row.FindViewById<TextView>(Resource.Id.textMenuPrice); txtHargaMenu.Text = mItems[position].hargaJual.ToString("N0"); txtKodeMenu = row.FindViewById<TextView>(Resource.Id.textKodeMenu); txtKodeMenu.Text = mItems[position].kodeMenu; butPlusMenu = row.FindViewById<ImageButton>(Resource.Id.ibPlusMenuFnb); butPlusMenu.Focusable = false; butPlusMenu.FocusableInTouchMode = false; //butPlusMenu.SetTag(position); butMinMenu = row.FindViewById<ImageButton>(Resource.Id.ibMinusMenuFnb); butMinMenu.FocusableInTouchMode = false; butMinMenu.Focusable = false; txtQty = row.FindViewById<TextView>(Resource.Id.txtQtyMenuFnb); //txtQty.Text = "0"; txtKodeMenu.Visibility = ViewStates.Invisible; imageMenu = row.FindViewById<ImageView>(Resource.Id.imageMenu); imageMenu.Focusable = false; imageMenu.FocusableInTouchMode = false; if (mItems[position].pic != null) { imageMenu.SetImageBitmap(bytesToBitmap(mItems[position].pic)); } else { imageMenu.SetImageResource(Resource.Drawable.noimage); } row.SetBackgroundColor(Color.Beige); return row; } public static Bitmap bytesToBitmap(byte[] imageBytes) { Bitmap bitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length); return bitmap; } public Filter Filter { get; private set; } private class MenuFilter : Filter { private listMenuAdapters menuAdapter; public MenuFilter(listMenuAdapters menuAdapter) { this.menuAdapter = menuAdapter; } protected override FilterResults PerformFiltering(ICharSequence constraint) { var returnObj = new FilterResults(); var results = new List<listMenuModels>(); if (menuAdapter._originalData == null) menuAdapter._originalData = menuAdapter.mItems; if (constraint == null) return returnObj; if (menuAdapter._originalData != null && menuAdapter._originalData.Any()) { results.AddRange( menuAdapter._originalData.Where( menu => menu.namaMenu.ToLower().Contains(constraint.ToString()))); } returnObj.Values = FromArray(results.ToArray()); return returnObj; } protected override void PublishResults(ICharSequence constraint, FilterResults results) { var res = new List<listMenuModels>(results.Values.ToArray<listMenuModels>()); menuAdapter.mItems = res; menuAdapter.NotifyDataSetChanged(); } } }
Что я уже пробовал:
Я попытался найти код, но не смог его найти
Member 13287700
добавить +1 к txtQty