title: ViewFlipper to flip listview item with onItemClickListener is not working
body: <p>I have created a ListView which is having viewFlipper as ListItem. ViewFlipper is having two relative layouts(ids are rView1, rView2). I am setting onItemClickListener() and OnItemLongClickListener for ListView.</p>
  
  <p>OnLongClickListener() viewFlipper will show nextView and onItemClickListener() checks viewFlipper current view. 
  Case 1:: If ViewFlipper's current view is - rView1 then it starts new activity. 
  Case 2:: If ViewFlipper's current view is - rView2 then it flips that view again.
  The problem is- case 2 is not working properly. some other view is flipping in list. Here is my code snippet - </p>
  
  <p>ListActivity-</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      Log.d("onCreate", "ListActivity");
      YouponDatabase.getInstance(getApplicationContext());
      setContentView(R.layout.yp_coupon_list);
      handler = new Handler();
      listView = (ListView) findViewById(R.id.yp_coupon_list);
      adapter = new ListAdapter(getApplicationContext());
      listView.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parentView, View view,
                  int position, long column) {
              View v = ((ViewFlipper) view.findViewById(R.id.view_flipper))
                      .getCurrentView();
              if (v.getId() == R.id.rView1) {
                  Log.d("ListActivity", "detail item click");
                  Intent intent = new Intent(ListActivity.this,
                          DetailActivity.class);
                  startActivity(intent);
              } else if (v.getId() == R.id.rView2) {
                  Log.d("ListActivity", "share item click::"
                          + view.toString());
                  adapter.flipItem(view);
              }
          }
      });
      listView.setOnItemLongClickListener(new OnItemLongClickListener() {
  
          @Override
          public boolean onItemLongClick(AdapterView&lt;?&gt; parentView,
                  View view, int position, long column) {
              Log.d("ListActivity", "item long click");
              adapter.flipItem(view, position);
              return true;
          }
      });
  }
  </code></pre>
  
  <p>ListAdapter-</p>
  
  <pre><code>public class ListAdapter extends BaseAdapter {
  
  private static class ViewHolder {
      private ViewFlipper flipper;
      private ImageView listImage;
      private TextView Area;
  };
  
  private LayoutInflater inflater;
  private Context appContext;
  private Handler handler = new Handler();
  private List&lt;item&gt; currentList;
  private DrawableLoader drawableLoader = null;
  private ViewHolder viewHolder;
  
  public ListAdapter(Context context) {
      inflater = (LayoutInflater) context
              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      appContext = context.getApplicationContext();
      drawableLoader = new DrawableLoader(appContext);
  }
  
  public void setList(List&lt;item&gt; list) {
      currentList = list;
  }
  
  @Override
  public int getCount() {
      if (currentList != null)
          return currentList.size();
      return 0;
  }
  
  @Override
  public Object getItem(int position) {
      return currentList.get(position);
  }
  
  @Override
  public long getItemId(int position) {
      return -1;
  }
  
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
      final item x = currentList.get(position);
  
      if (convertView == null) {
          convertView = inflater.inflate(R.layout.yp_coupon_list_content,
                  null);
      }
      viewHolder = (ViewHolder) convertView.getTag();
      if (viewHolder == null &amp;&amp; convertView.getId() == -1) {
          viewHolder = new ViewHolder();
          viewHolder.flipper = (ViewFlipper) convertView
                  .findViewById(R.id.view_flipper);
          viewHolder.listImage = (ImageView) convertView
                  .findViewWithTag(appContext.getResources().getString(
                          R.string.yp_image_tag));
          viewHolder.Area = (TextView) convertView
                  .findViewById(R.id.yp_coupon_area);
          convertView.setTag(viewHolder);
      } else {
          View v = viewHolder.flipper.getCurrentView();
          if (v.getId() == R.id.deal_share) {
              Log.d("list Adapter", "Reset it");
              viewHolder.flipper.setDisplayedChild(0);
          }
      }
      viewHolder.Area.setText(x.getArea());
      return convertView;
  }
  
  public void flipItem(View view, int position) {
      if (view != null) {
          Log.d("flipItem", "" + view.toString());
          ViewFlipper viewFlipper = ((ViewFlipper) view
                  .findViewById(R.id.view_flipper));
          if (viewFlipper.getCurrentView().getId() == R.id.deal_detial) {
              Log.d("flipItem", "now share comes");
              viewFlipper.showNext();
              ImageView share = (ImageView) view.findViewById(R.id.share);
              share.setOnClickListener(new OnClickListener() {
  
                  @Override
                  public void onClick(View arg0) {
                      Log.d("Share clicked", "Inflate layout");
                  }
              });
          } else {
              Log.d("flipItem", "now detail comes");
              viewFlipper.showNext();
          }
  
      }
  }
  
  public void flipItem(View view) {
      if (view != null) {
          Log.d("flipItem", "" + view.toString());
          ViewFlipper viewFlipper = ((ViewFlipper) view
                  .findViewById(R.id.view_flipper));
          viewFlipper.showNext();
      }
  }
  </code></pre>
  
  <p>Please help me, I can not figure out what is wrong in my code.</p>