title: switch case working in second long press but not on first long press
body: <p>I am trying to capture the long click event and displaying a alert box of items inside the list view.. which I am doing using switch case... which was working fine.</p>
  
  <p>Issue:</p>
  
  <p>when I long press the items inside the listview at <code>first long press</code> no alert box is displayed but if I do the same <code>second time</code> alert box is displayed.. I couldn't understand the behaviour...</p>
  
  <p>Can experts help me with this also please let me know where I am doing wrong and also correct me so that at first long press I need to get the alert box.</p>
  
  <p>Code:</p>
  
  <pre><code>Listview.setOnItemLongClickListener(new OnItemLongClickListener() {
  
              @Override
              public boolean onItemLongClick(final AdapterView&lt;?&gt; arg0, View arg1,
                      int arg2, long arg3) {
                  // TODO Auto-generated method stub
  
                  System.out.println("Inside listview long click");   
  
  
                      final ViewHolder myviewholder3=new ViewHolder();
                      myviewholder3.cb=(CheckBox) arg1.findViewById(R.id.checkBox1);
                      myviewholder3.view1=(Button) arg1.findViewById(R.id.button1); 
  
                      System.out.println(arg1.getId());
                      System.out.println("cb"+R.id.checkBox1);
                      System.out.println(arg1.getId());
                      System.out.println("butt"+R.id.button1);
                      switch(arg1.getId()){
  
                      case R.id.checkBox1:
                      myviewholder3.cb.setOnLongClickListener(new OnLongClickListener() {
  
                          @Override
                          public boolean onLongClick(View v) {
                              // TODO Auto-generated method stub
                              AlertDialog.Builder Alert1=new AlertDialog.Builder(sm.this);
  
                              StockAlert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  
                                  @Override
                                  public void onClick(DialogInterface dialog, int which) {
                                      // TODO Auto-generated method stub
  
                                  }
                              });
                              Alert1.show();
                              return false;
                          }
                      });
  
                      break;
  
                      case R.id.button1:
                      myviewholder3.view1.setOnLongClickListener(new OnLongClickListener() {
  
                          @Override
                          public boolean onLongClick(View v) {
                              // TODO Auto-generated method stub
                              AlertDialog.Builder ViewDetailAlert=new AlertDialog.Builder(sm.this);
  
                              Alert2.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  
                                  @Override
                                  public void onClick(DialogInterface dialog, int which) {
                                      // TODO Auto-generated method stub
  
                                  }
                              });
                              Alert2.show();
                              return false;
                          }
                      });
                      break;
  
              default:
                  System.out.println("No Selection");
                      }
                      return false;
              }
          }); 
  </code></pre>