title: How can you tell which item is clicked on ListView?
body: <p>I have a bunch of items on my ListView, but I don't know how to implement a listener on a specific item. I also tried to use the if statement and still didn't work.</p>
  
  <p>I tried this code:</p>
  
  <pre><code>list.setOnItemClickListener(new OnItemClickListener() {                                                                                                                                                             
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position,long id)                               
          {                                                                                                                                                                           
              if(list.getItemAtPosition(position).equals(mStrings[0]))                                                       
              {                                                                                                           
                  Intent i = new Intent(MainActivity.this, Activity2.class);                                                                                        
                  startActivity(i);                                                                                
                  }                                                                                                    
              }                                                                                                       
          });
  }
  </code></pre>
  
  <p>But this code is applied to all items.</p>