Example #1
0
  private void showList() {

    this.setContentView(R.layout.mark_list);

    this.setTitle("所有书签");

    if (marksList == null || listmodified) {
      marksList = dbHelper.getAllMarks();
      listmodified = false;
    }

    marksString = new ArrayList<CharSequence>(marksList.size());

    for (Iterator<Mark> iterator = marksList.iterator(); iterator.hasNext(); ) {
      Mark mark = iterator.next();

      marksString.add(mark.toString());
    }

    listview = (ListView) findViewById(R.id.list_marks);
    listview.setAdapter(new BaseAdapterNull(this));

    final Adapter4MarkList baseAdapterNew = new Adapter4MarkList(this);

    baseAdapterNew.setContentList(marksString);

    baseAdapterNew.setTextsize(16);

    listview.setAdapter(baseAdapterNew);
    listview.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listview.setSelection(0);
    listview.requestFocus();

    Button btn = (Button) this.findViewById(R.id.btnRtnFromMarks);
    btn.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            MarkActivity.this.finish();
          }
        });

    this.registerForContextMenu(listview);
  }
Example #2
0
 /*
  * (non-Javadoc)
  *
  * @see android.app.Activity#onDestroy()
  */
 @Override
 protected void onDestroy() {
   // System.out.println("ondestroy");
   dbHelper.close();
   super.onDestroy();
 }