title: problems opening listView items with intents in android studio
body: <p>I have a listView with 2 items in the list, the first item in position 0 responds to clicks but the other does not! i have tried to copy the same onclick method and changed the if statement to the list item in position 1 but it is not working out for me so i am looking how to get this working if someone could help me? i have included the only code i think is needed to resolve this,</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public class TopLevelActivity extends Activity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_top_level);
          //Create an OnItemClickListener
          AdapterView.OnItemClickListener itemClickListener =
              new AdapterView.OnItemClickListener() {
                  public void onItemClick(AdapterView&lt;?&gt; listView,
                                          View v,
                                          int position,
                                          long id) {
                      if (position == 0) {
                          Intent intent = new Intent(TopLevelActivity.this,
                                                     DrinkCategoryActivity.class);
                          startActivity(intent);
                      }
                  }
              };
          //Add the listener to the list view
          ListView listView = (ListView) findViewById(R.id.list_options);
          listView.setOnItemClickListener(itemClickListener);
      
  
        //what ive tried to open the foodCategoryActivity list item
  
  AdapterView.OnItemClickListener itemClickListener =
              new AdapterView.OnItemClickListener() {
                  public void onItemClick(AdapterView&lt;?&gt; listView,
                                          View v,
                                          int position,
                                          long id) {
                      if (position == 1) {
                          Intent intent = new Intent(TopLevelActivity.this,
                          
                          FoodCategoryActivity.class);
                          startActivity(intent);
                      }
                  }
              };
          //Add the listener to the list view
          ListView listView = (ListView) findViewById(R.id.list_options);
          listView.setOnItemClickListener(itemClickListener);
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>thank you.</p>