title: void is an invalid type for the variable onListItemClick?
body: <p>I've been trying to set up a simple <code>onClickListener</code> on an android activity which extends <code>ListActivity</code>.</p>
  
  <p>Within this classes on create method, I create a spinner object which when a user selects an item, an <code>arrayAdapter</code> list item is created, depending on what the user selected (populated from a cursor request). This is generated within another method within the same class.</p>
  
  <pre><code>ArrayAdapter&lt;String&gt; playerAdapter = new ArrayAdapter&lt;String&gt;(this,
              R.layout.match_update_rows, R.id.player_name, playerItems);
  
      setListAdapter(playerAdapter);
  </code></pre>
  
  <p>I'm trying to add a click listener on this new list. I have added:</p>
  
  <pre><code>    @Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
          super.onListItemClick(l, v, position, id);
          Intent i = new Intent(this, PlayerFixtureScore.class);
          i.putExtra("RowId", id);
          startActivity(i);
      }
  </code></pre>
  
  <p>However, I'm getting an error on the <code>protected void onListItemClick</code> line.</p>
  
  <pre><code>Multiple markers at this line
  - Syntax error on token ")", ; expected
  - Syntax error on token ",", ; expected
  - Duplicate local variable position
  - Syntax error on token ",", ; expected
  - Duplicate local variable id
  - Duplicate local variable l
  - Syntax error on token "(", ; expected
  - Duplicate local variable v
  - Syntax error on token ",", ; expected
  - void is an invalid type for the variable 
   onListItemClick
  </code></pre>
  
  <p>Also, if I select the <code>onListItemClick</code> line, Eclipse says <code>'void is an invalid type for the variable onListItemClick'</code>?</p>
  
  <p>All works if I remove the click listener code, just cannot work out how to add the listener on the <code>arrayAdapter</code> item so I can tell which item the user has clicked on -- any help appreciated!</p>
  
  <p>As requested by MyD - here is the complete class listing:
      Thanks for your prompt responses. In reply to MByD here is the complete code listing for this class. Any suggestions appreciated!</p>
  
  <pre><code>public class MatchUpdate extends ListActivity {
  /** Called when the activity is first created. */
  private int cursorCounter = 0;
  private int spinnerSelected;
  /** Set up the db for inital use */
  DataBaseHelper myDbHelper = new DataBaseHelper(this);
  Match match;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.match_update);
  
      try {
          myDbHelper.createDataBase();
      } catch (IOException ioe) {
          throw new Error("Unable to create database");
      }
      try {
          myDbHelper.openDataBase();
      } catch (SQLException sqle) {
          throw sqle;
      }
  
      // create a spinner for fixture selection
      Spinner fixtureSpin = (Spinner) findViewById(R.id.fixtures);
  
      // Get all fixtures for Spinner...
      Cursor cur = myDbHelper.getFixtures();
  
      // create match object for cursor results
      match = new Match(cur.getCount());
  
      // Populate match object with Cursor results
      for (cur.moveToFirst(); !cur.isAfterLast(); cur.moveToNext()) {
          match.setFixtureId(cursorCounter, cur.getInt(0));
          match.setHomeId(cursorCounter, cur.getInt(1));
          match.setHomeTeam(cursorCounter, cur.getString(2));
          match.setAwayId(cursorCounter, cur.getInt(3));
          match.setAwayTeam(cursorCounter, cur.getString(4));
          match.setDate(cursorCounter, cur.getString(5));
          cursorCounter++;
      }
  
      // Set up adapters for fixture spinner
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
              android.R.layout.simple_spinner_item, match.getFixtureList());
  
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
      // Set up fixture spinner
      fixtureSpin.setAdapter(adapter);
  
      // Set fixture spinner listener
      fixtureSpin.setOnItemSelectedListener(new MyOnItemSelectedListener());
  
  }
  
  public class MyOnItemSelectedListener implements OnItemSelectedListener {
  
      public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos,
              long id) {
          spinnerSelected = parent.getSelectedItemPosition();
          updatePlayers(match);
      }
  
      public void onNothingSelected(AdapterView&lt;?&gt; parent) {
          // Do nothing.
      }
  }
  
  public void updatePlayers(Match thisMatch) {
  
      // Get players for selected fixture based on Spinner selection
      Cursor playerCur = myDbHelper.getFixturePlayers(
              thisMatch.getHomeId(spinnerSelected),
              thisMatch.getAwayId(spinnerSelected));
  
      // set up simple ArrayAdapter to hold player names
      String[] playerItems;
      playerItems = new String[playerCur.getCount()];
      int cnt = 0;
  
      // pull player data from cursor, into a simple array
      for (playerCur.moveToFirst(); !playerCur.isAfterLast(); playerCur
              .moveToNext()) {
          playerItems[cnt] = playerCur.getString(0);
          cnt++;
  
      }
  
      ArrayAdapter&lt;String&gt; playerAdapter = new ArrayAdapter&lt;String&gt;(this,
              R.layout.match_update_rows, R.id.player_name, playerItems);
  
      setListAdapter(playerAdapter);
  
      @Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
          super.onListItemClick(l, v, position, id);
          Intent i = new Intent(this, PlayerFixtureScore.class);
          i.putExtra("RowId", id);
          startActivity(i);
      }
  }
  
  }
  </code></pre>