コード例 #1
0
ファイル: EventsActivity.java プロジェクト: lite/ad-pad
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setContentView(R.layout.main);

    ItemAdapter adapter;
    try {
      adapter = ItemAdapter.createFromXml(this, R.xml.events_items);
      setListAdapter(adapter);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setActionBarContentView(R.layout.list);

    ItemAdapter adapter = new ItemAdapter(this);
    adapter.add(new TextItem("Basic items"));
    adapter.add(new TextItem("XML items"));
    adapter.add(new TextItem("Tweaked item cell"));
    adapter.add(new TextItem("SegmentedBar"));
    adapter.add(new TextItem("ActionBarActivity"));

    mListView = (ListView) findViewById(android.R.id.list);
    mListView.setAdapter(adapter);
    mListView.setOnItemClickListener(mItemClickHandler);
  }