title: Why can't I remove an item?
body: <p>I am really frustrated because I have been trying this for 4 hours today, and I can't find a solution. For some reason, my on long click listener doesn't get detected sometimes!   </p>
  
  <pre><code> listview.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView&lt;?&gt; arg0, View arg1,
                                         int pos, long id) {
  
              Toast.makeText(MainActivity.this, "Long click", Toast.LENGTH_SHORT).show();
  
              contactArrayList.remove(pos);
              arrayAdapter.notifyDataSetChanged();
  
  
              return true;
          }
      }); 
  </code></pre>
  
  <p>This simple code just removes an item from my list and my array list using an adapter. But, sometimes, <strong>the onItemLongClickListener doesn't even get called, and the toast doesn't even display!!</strong> I know that android is detecting it, because I get this message whenever I long click in my log cat:</p>
  
  <pre><code>/ViewRootImpl: ViewRoot's Touch Event : ACTION_UP
  </code></pre>
  
  <p>So why does it only work sometimes? Is there something wrong with my code, or is this a problem with android itself? If it is a problem with android, how can I fix it? </p>
  
  <p><strong>It works the first time, but after exiting my app, rotating the screen, etc. , Long press stops getting detected. I have been stuck on this for almost 8 hours now, and I really, really, really need your help.</strong></p>