ListFragment onListItemClick strange behaviour

Monday, May 12, 2014

In my CustomList fragment I want to show an image inside item layout each time item is clicked:

public class CustomList extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> {

public void onListItemClick(ListView list, View view, int position, long id) {
super.onListItemClick(list, view, position, id);

ImageView imageToShow = (ImageView) view.findViewById(;
if (imageToShow != null) {
if (imageToShow.getVisibility() == View.INVISIBLE) {


The row item layout has an ImageView with visibility attribute set to "invisible"

<LinearLayout xmlns:android="" xmlns:tooth=""
<!-- ... -->
android:visibility="invisible" />

The problem is, when row item is clicked, the image appears for it, but also it appears for other item from the bottom of the list. So if I click item on position 0, the image appears also on item with position 7. I can't figure out what is the reason for that behaviour.