@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); // Add the current goal to the selected player Player player = PlayersContent.getAllPlayers().get(position); // Set the result as ok and pass the game back Intent intent = new Intent(); intent.putExtra(GoalScorer.EXTRA_PLAYER, player); setResult(RESULT_OK, intent); finish(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Show the Up button in the action bar. setupActionBar(); this.adapter = new ArrayAdapter<Player>( this, android.R.layout.simple_list_item_1, android.R.id.text1, PlayersContent.getAllPlayers()); this.setListAdapter(this.adapter); }