コード例 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    boolean result = false;

    switch (item.getItemId()) {
      case R.id.menu_add:
        MyCell myCell = new MyCell();
        myCell.name = "New Cell!!!";
        addNewCell(myCell);
        result = true;
        break;
    }

    return result;
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    for (int i = 0; i < 50; i++) {
      MyCell cell = new MyCell();
      cell.name = "Cell No." + Integer.toString(i);
      mAnimList.add(cell);
    }

    mMyAnimListAdapter = new MyAnimListAdapter(this, R.layout.chain_cell, mAnimList);
    mListView = (ListView) findViewById(R.id.chainListView);
    mListView.setAdapter(mMyAnimListAdapter);
  }