aminovic09
aminovic09

Reputation: 81

how can i change text of TextView in ListView when we click the Button?

I have a ListView with a Button and a TextView and i want to change text of TextView when i click in Button. I handle the click and when i click the Button android:onClick="myClickHandler" i change the text value of TextView but the problem is when i scroll the ListView i found the same text in other cells in ListView. how can i resolve this problem?
tanx a lot.

this is the method to handle click

public void myClickHandler(View v) 
{

    //get the row the clicked button is in
    LinearLayout vwParentRow = (LinearLayout)v.getParent();
    TextView child = (TextView)vwParentRow.getChildAt(1);
    child.setText("bma bla");

}

Upvotes: 1

Views: 798

Answers (1)

Tugrul
Tugrul

Reputation: 1808

Refresh the listadapter and listview adapter every change at the same time. I think it will help you.

Upvotes: 1

Related Questions