Example #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    mDoingListView = (ListView) findViewById(R.id.doing_list);
    mDoingListAdapter = new DoingListAdapter(this, null);
    mDoingListView.setAdapter(mDoingListAdapter);
    mDoingListView.setOnItemLongClickListener(this);
    mDoingListView.setOnItemClickListener(this);

    TitleBar titleBar = (TitleBar) findViewById(R.id.title_bar);
    titleBar.setTitle(R.string.bar_title_main);

    Button buttonHome = new Button(this);
    buttonHome.setText(R.string.button_title_home);
    buttonHome.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(MainActivity.this, HomeActivity.class);
            startActivity(intent);
            finish();
          }
        });
    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(
            (int) (68 * Constants.density), (int) (40 * Constants.density));
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    titleBar.setLeftView(buttonHome, params);

    Button buttonNew = new Button(this);
    buttonNew.setText(R.string.button_title_new);
    buttonNew.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(MainActivity.this, EditActivity.class);
            startActivity(intent);
          }
        });
    params =
        new RelativeLayout.LayoutParams(
            (int) (68 * Constants.density), (int) (40 * Constants.density));
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    titleBar.setRightView(buttonNew, params);
  }
Example #2
0
 @Override
 protected void onResume() {
   mDoingListAdapter.notifyDataSetChanged();
   super.onResume();
 }
Example #3
0
 @Override
 public void onDestroy() {
   mDoingListAdapter = null;
   mDoingListView = null;
   super.onDestroy();
 }