Q:

Changing the visibility of a Image View on touch Row of ListView

I have a Fragment in Which one List View includes and I set Adapter to list. I created a custom adapter that have one Text View left and Image View right. I want 
on touch row of list only image show in one row and when touch second time first image hide and second row  image show. continue for list.how it is possible
    package com.jeff.adapter;
import android.content.Context;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.jeff.xstitch.R;
import com.parse.FindCallback;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;

import java.text.ParseException;
import java.util.List;

public class ShopingAdapter extends BaseAdapter {
    public List<ParseObject> views;
    private Context ctx;

    public ShopingAdapter(List<ParseObject> object, Context ctx) {
        this.views = object;
        this.ctx = ctx;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return views.size();
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        final ParseObject object = views.get(position);
        String sTextShoping = (String) object.get("name");
        String isVisisble = object.getString("ISVISIBLE");

        if (convertView == null) {
            convertView = View.inflate(this.ctx, R.layout.shoping_adapter, null);
        } else {
        }
        TextView text1 = (TextView) convertView.findViewById(R.id.textView1);
        ImageView ivDelete = (ImageView) convertView.findViewById(R.id.imageView2);
        text1.setText(sTextShoping);

        if (isVisisble != null)
        {
                if (ivDelete.getVisibility() == View.INVISIBLE) {
                    ivDelete.setVisibility(View.VISIBLE);
                } else {
                    ivDelete.setVisibility(View.INVISIBLE);
                }
            }

        else
            ivDelete.setVisibility(View.INVISIBLE);

        ivDelete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                ParseUser user = ParseUser.getCurrentUser();
                ParseQuery<ParseObject> query = ParseQuery.getQuery("shopping_list");
                query.whereEqualTo("owner", user);
                query.findInBackground(new FindCallback<ParseObject>() {
                    @Override
                    public void done(List<ParseObject> list, com.parse.ParseException e) {
                        if (e == null) {
                            object.deleteInBackground();
                            views.remove(position);
                            notifyDataSetChanged();

                        } else {
                            Toast.makeText(ctx, e.getLocalizedMessage(),
                                    Toast.LENGTH_SHORT).show();
                        }
                    }
                });

            }
        });

        return convertView;
    }

    public void updateNewList(List<ParseObject> list) {
        views.clear();
        views.addAll(list);
    }

}

A:

If you want to hide the ImageView by default and make is visible after clicking on the list position, Simply set the ImageView to hidden at the beginning then make it visible after the list item click.
        //first make a int that holds the clicked position,
        int current_position = -1;

         @Override
         public View getView(final int position, View convertView, ViewGroup parent) {

            ImageView ivDelete = (ImageView) convertView.findViewById(R.id.imageView2);
            // check if the current_position has been changed once 
            // and it matches the position in list
            if (position > 0 && position == current_position){
            ivDelete.setVisibity(View.VISIBLE);
            }
            else {
            ivDelete.setVisibity(View.GONE);  

            }
                convertView.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                        ivDelete.setVisibitiy(View.VISIBLE);
                        // set the current_position to list position
                        current_position = position; 
                        }
                    });
            }

Now every-time you delete a list item set the current_position = -1;
This will hide the ImageView again and won't display until you click on a list item again. 

