/** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.dataviewer);
   loadPrefs();
   mDbHelper = new DataDBAdapter(this);
   mDbHelper.open();
   fillData();
   registerForContextMenu(getListView());
 }
  private void fillData() {
    // Get all of the notes from the database and create the item list
    mDbHelper.close();
    mDbHelper = new DataDBAdapter(this);
    mDbHelper.open();
    mLogCursor = mDbHelper.fetchAllLogs();
    startManagingCursor(mLogCursor);

    String[] from = new String[] {DataDBAdapter.KEY_TIMESTAMP};
    int[] to = new int[] {R.id.text1};

    // Now create an array adapter and set it to display using our row
    SimpleCursorAdapter logs =
        new SimpleCursorAdapter(this, R.layout.viewer_row, mLogCursor, from, to);
    setListAdapter(logs);
  }