Beispiel #1
0
 // ! Helper method to load an up-to-date cursor and set adapter.
 protected void reloadList() {
   Cursor c = m_db.queryAllPersons();
   m_adapter.changeCursor(c);
   releaseList();
   m_cursor = c;
   Log.d(TAG, "Create cursor");
 }
Beispiel #2
0
  /*! \brief Callback method (Activity), called if a instance
   *         of this activity has been created.
   *
   *  Database object is created and adapter is created.
   *
   *  \param savedInstanceState bundle to save extra state info.
   *         No extra fields have been added to this Bundle.
   * */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.d(TAG, "onCreate()");

    m_db = new StalkerDatabase(getApplicationContext());

    m_cursor = m_db.queryAllPersons();

    m_adapter =
        new SimpleCursorAdapter(
            this,
            android.R.layout.simple_list_item_2,
            m_cursor,
            new String[] {StalkerDatabase.Person.NAME, StalkerDatabase.Person.NUMBER},
            new int[] {android.R.id.text1, android.R.id.text2});

    setListAdapter(m_adapter);
  }