title: Android - Can't call setOnItemClickListener from a ListView
body: <p>I've been following some Android development tutorials on Udemy, which have been very helpful, but now I've run into an issue with the tutors code. Not sure if this is because of an updated SDK or what, but the code does not error out in his video.</p>
  
  <pre><code>package com.example.app;
  
  import android.app.ListActivity;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.ActionBar;
  import android.support.v4.app.Fragment;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.os.Build;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  import android.widget.AdapterView.OnItemClickListener;
  
  public class MainActivity extends ListActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          String[]countries=getResources().getStringArray(R.array.countries);
          this.setListAdapter(new ArrayAdapter&lt;String&gt;(
                  this,
                  R.layout.list_element,
                  R.id.countryName,
                  countries));
      }
  
      ListView listview = getListView();
  
      listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView&lt;?&gt;  parent, View clickView, int position, long id) {
              String country = countries[position];
              Toast.makeText(MainActivity.this, String.format("%s was chosen.", country),
                      Toast.LENGTH_SHORT).show();
          }
      });
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
  
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  
      /**
       * A placeholder fragment containing a simple view.
       */
      public static class PlaceholderFragment extends Fragment {
  
          public PlaceholderFragment() {
          }
  
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
              View rootView = inflater.inflate(R.layout.fragment_main, container, false);
              return rootView;
          }
      }
  
  }
  </code></pre>
  
  <p>The errors start here, with a "Cannot resolve symbol" error.</p>
  
  <pre><code>listview.setOnItemClickListener
  </code></pre>
  
  <p>and further errors continue throughout the containing loop.</p>