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);
  }
 /** 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());
 }
 @Override
 public boolean onContextItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case DELETE_ID:
       AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
       mDbHelper.deleteLog(info.id);
       Intent i = getIntent();
       finish();
       startActivity(i);
       return true;
   }
   return super.onContextItemSelected(item);
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   // The activity is about to be destroyed.
   mDbHelper.close();
 }