示例#1
0
  @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();
  }
示例#2
0
  @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);
  }