title: Show/hide listview item onclick
body: <p>I've <code>ListView</code> which shows rows "headers" and I want to make possibly to open "bodies" on tap and close it on tap again. Everybody can imagine it (it's like an <code>Expandable ListView</code>). So I don't want to use <code>Expandable ListView</code> but can't make to disappear "body" of my rows. Here is the code : </p>
  
  <pre><code>feedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; adapter, final View view, int position, long arg) {             
              LinearLayout body = (LinearLayout) view.findViewById(R.id.lInfo);
              ImageView div = (ImageView) view.findViewById(R.id.divider);
  
             switch(body.getVisibility()){
                  case (View.GONE): {                       
                      body.setVisibility(View.VISIBLE);
                      div.setVisibility(View.VISIBLE);
                      Log.w("body vis",""+body.getVisibility());
                      Log.w("set visible","VISIBLE!");
                  }
                  break;
                 case (View.VISIBLE):{                       
                     body.setVisibility(View.GONE);
                     div.setVisibility(View.GONE);
                 }
                 break;
  
                }
  
          }
      });
  }
  </code></pre>
  
  <p>My activity layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  
  
  
  &lt;RelativeLayout
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:background="@drawable/fon1"&gt;
  
  &lt;com.susudashonline.ParallaxListView
  
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:id="@+id/lvContacts"
  android:layout_gravity="center_horizontal"
  android:divider="#00ffffff"
  android:dividerHeight="1dp"
  android:clickable="false"/&gt;
  &lt;/RelativeLayout&gt;
  
  
  
  &lt;ListView android:id="@+id/left_drawer"
  android:layout_width="250dp"
  android:layout_height="match_parent"
  android:layout_gravity="start"
  android:choiceMode="singleChoice"
  android:divider="#002d1816"
  android:dividerHeight="2dp"
  android:background="#D92d1816"/&gt;
  
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>And my <strong>list_item</strong> layout: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  &gt;
  &lt;LinearLayout
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"&gt;
  &lt;TextView
      android:id="@+id/fName"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:textSize="20sp"
      android:textStyle="bold"
      android:textColor="#ffffff"
      android:gravity="center"
      android:minHeight="40dp"
      android:background="#2d1816"
      /&gt;
  
  
  &lt;ImageView
      android:id="@+id/divider"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:src="@drawable/divider"
      android:contentDescription="@string/imgDesc"
      android:layout_gravity="center_horizontal"
      android:layout_marginTop="-1dp"
  
    /&gt;
  &lt;LinearLayout
      android:id="@+id/lInfo"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:orientation="vertical"
      android:background="#CC2d1816"
  
      &gt;
      &lt;TextView
          android:id="@+id/tvAddress"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="address"
          android:textColor="#ffffff"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"
          /&gt;
      &lt;TextView
          android:id="@+id/tvDekanat"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvPhone"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvEmail"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:autoLink="email"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"
          /&gt;
      &lt;TextView
          android:id="@+id/tvSite"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:autoLink="web"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvEmailTwo"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:autoLink="email"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvSiteTwo"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:autoLink="web"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvTime"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvShedule"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;TextView
          android:id="@+id/tvWorkTime"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:textColor="#ffffff"
          android:layout_marginLeft="15dp"
          android:layout_marginStart="15dp"
          android:text="@string/workTime"
          android:textSize="17sp"
          android:layout_marginTop="10dp"/&gt;
      &lt;LinearLayout
          android:id="@+id/llShedule"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
              &lt;TextView
                  android:id="@+id/tvShedule1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
              &lt;TextView
                  android:id="@+id/tvTime1"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
              &lt;/LinearLayout&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
              &lt;TextView
                  android:id="@+id/tvShedule2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
              &lt;TextView
                  android:id="@+id/tvTime2"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
              &lt;TextView
                  android:id="@+id/tvShedule3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
              &lt;TextView
                  android:id="@+id/tvTime3"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="horizontal"&gt;
              &lt;TextView
                  android:id="@+id/tvShedule4"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
              &lt;TextView
                  android:id="@+id/tvTime4"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="15dp"
                  android:layout_marginStart="15dp"
                  android:textColor="#ffffff"
                  android:textSize="17sp"
                  android:layout_marginTop="10dp"/&gt;
          &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>And it's my adapter <strong>getView</strong> :</p>
  
  <pre><code> public View getView(int position, View convertView, ViewGroup parent) {
      ViewHolder holder;
      if (convertView == null) {
          convertView = layoutInflater.inflate(R.layout.contact_item, null);
          holder = new ViewHolder();
          holder.body = (LinearLayout)convertView.findViewById(R.id.lInfo);
          holder.facultyName = (TextView) convertView.findViewById(R.id.fName);
          holder.mAddress = (TextView) convertView.findViewById(R.id.tvAddress);
          holder.mDekanat = (TextView) convertView.findViewById(R.id.tvDekanat);
          holder.mPhone = (TextView) convertView.findViewById(R.id.tvPhone);
          holder.mEmail = (TextView) convertView.findViewById(R.id.tvEmail);
          holder.mSite = (TextView) convertView.findViewById(R.id.tvSite);
          holder.mSiteTwo = (TextView) convertView.findViewById(R.id.tvSiteTwo);
          holder.mEmailTwo = (TextView) convertView.findViewById(R.id.tvEmailTwo);
          holder.mShedule = (TextView) convertView.findViewById(R.id.tvShedule);
          holder.mTime = (TextView) convertView.findViewById(R.id.tvTime);
          holder.mTime1 = (TextView) convertView.findViewById(R.id.tvTime1);
          holder.mTime2 = (TextView) convertView.findViewById(R.id.tvTime2);
          holder.mTime3 = (TextView) convertView.findViewById(R.id.tvTime3);
          holder.mTime4 = (TextView) convertView.findViewById(R.id.tvTime4);
          holder.llShedule = (LinearLayout)convertView.findViewById(R.id.llShedule);
          holder.mShedule1 = (TextView) convertView.findViewById(R.id.tvShedule1);
          holder.mShedule2 = (TextView) convertView.findViewById(R.id.tvShedule2);
          holder.mShedule3 = (TextView) convertView.findViewById(R.id.tvShedule3);
          holder.mShedule4 = (TextView) convertView.findViewById(R.id.tvShedule4);
          holder.mWorkTime = (TextView) convertView.findViewById(R.id.tvWorkTime);
          holder.mDivider = (ImageView) convertView.findViewById(R.id.divider);
  </code></pre>
  
  <p>//            holder.mImage = (ImageView) convertView.findViewById(R.id.imgContact);</p>
  
  <pre><code>        convertView.setTag(holder);
      } else {
          holder = (ViewHolder) convertView.getTag();
  
      }
      ContactItem contactItem = (ContactItem) listData.get(position);
      Typeface font = Typeface.createFromAsset(mContext.getAssets(), "OpenSans-Regular.ttf");
      holder.facultyName.setTypeface(font);
      holder.facultyName.setText(contactItem.getName());
      holder.mEmail.setVisibility(View.GONE);
      holder.mDekanat.setVisibility(View.GONE);
      holder.mPhone.setVisibility(View.GONE);
      holder.mSite.setVisibility(View.GONE);
      holder.mAddress.setVisibility(View.GONE);
      holder.mSiteTwo.setVisibility(View.GONE);
      holder.mShedule.setVisibility(View.GONE);
      holder.mEmailTwo.setVisibility(View.GONE);
      holder.mTime.setVisibility(View.GONE);
      holder.llShedule.setVisibility(View.GONE);
      holder.mWorkTime.setVisibility(View.GONE);
      holder.body.setVisibility(View.GONE);
  
      return convertView;
  }
  </code></pre>
  
  <p>As you can see I set VISIBILITY to GONE in my adapter and then in OnClick method make VISIBLE and it works! But when I tap on "header" again nothing happens! What should I do to hide body after I already show it?</p>