On Button Click how to increment counter and show in textview

前端 未结 4 1948
天涯浪人
天涯浪人 2021-01-22 06:58

I am working on a shopping cart assignment for that I have created a custom ListView that contains the Picture, Price and Add to Cart button in each row. I also have a textview

4条回答
  •  不知归路
    2021-01-22 07:42

    Your tv TextView isn't in the list row layout(where you search for it right now). You'll have to look for it in the activity layout if you declared it there(or in the layout where you declared it):

    final TextView tv  = (TextView)findViewById(R.id.tvCount);
    

提交回复
热议问题