0

I have to hide a TextView on click on an item in a Listview.

So my problem is that is when I click an item the toast generated is right while the view to hide is modified every 6 item.

list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {

String selected = ((TextView) view.findViewById(R.id.name)).getText().toString();

TextView selected_item = (TextView)view.findViewById(R.id.name);
selected_item.setVisibility(View.GONE);

Toast toast=Toast.makeText(getApplicationContext(), selected, Toast.LENGTH_SHORT);
toast.show();

}
});

here some screenshot:

before click:

enter image description here

after click:

enter image description here

How can i fix this? Thanks :)

mmBs
  • 8,421
  • 6
  • 38
  • 46

0 Answers0