@Subscribe(sticky = true, threadMode =ThreadMode.MAIN) public void onModelLoaded(ModelLoadedEvent event) { ((SimpleCursorAdapter)getListAdapter()).changeCursor(event.model); if (sv!=null) { sv.setEnabled(true); } }
@Test public void testChangeCursor() { SimpleCursorAdapter adapter = new SimpleCursorAdapter(context, 1, null, new String[] {"name"}, new int[] {2}, 0); Cursor cursor = setUpDatabase(); adapter.changeCursor(cursor); assertThat(adapter.getCursor()).isSameAs(cursor); }
public void onDestroy() { if (filterAdapter != null) { filterAdapter.changeCursor(null); filterAdapter = null; } } }
public void onDestroy() { if (autoCompleteAdapter != null) { autoCompleteAdapter.changeCursor(null); autoCompleteAdapter = null; } }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { this.simpleCursorAdapter.changeCursor(cursor); }
public void saveButton(View view){ EditText editText = (EditText) findViewById(R.id.edit_text); String data = editText.getText().toString(); database.insertData(data); Log.v("database",database.getAllData().toString()); // using the changeCursor method provides a cursor that can be // updated with a 'screenshot' of the latest data returned by the database. SimpleCursorAdapter adapter = (SimpleCursorAdapter) listview.getAdapter(); adapter.changeCursor(database.getAllData()); }
private void refreshListView() { c = dbRead.query("user", null, null, null, null, null, null); adapter.changeCursor(c); // c.close(); }
adapter.changeCursor(updatedCursor);
Spinner spinner1 = (Spinner) findViewById(R.id.spinner1); Cursor c1 = (some code for getting a cursor from an data source, for example, a sqlite database) SimpleCursorAdapter adapter1 = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, c1, new String[]{"column_name"}, new int[]{android.R.id.text1}); spinner1.setAdapter(adapter1); Spinner spinner2 = (Spinner) findViewById(R.id.spinner2); Cursor c2 = (some code for getting a cursor from an data source, for example, a sqlite database) SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, c2, new String[]{"column_name"}, new int[]{android.R.id.text1}); spinner2.setAdapter(adapter2); spinner1.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Cursor c_new = (create a new cursor); adapter2.changeCursor(c_new); adapter2.notifyDataSetChanged(); // this is important for notifying the UI spinner2.setAdapter(adapter2); } });
@Implementation public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { mOriginalFrom = from; mTo = to; realSimpleCursorAdapter.changeCursor(c); findColumns(mOriginalFrom); }
@Implementation public void changeCursor(Cursor c) { realSimpleCursorAdapter.changeCursor(c); // rescan columns in case cursor layout is different findColumns(mOriginalFrom); }
@Implementation public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { mOriginalFrom = from; mTo = to; realSimpleCursorAdapter.changeCursor(c); findColumns(mOriginalFrom); }
.getReadableDatabase() .rawQuery("SELECT * FROM " + DatabaseHelper.LIST + " ORDER BY " + DatabaseHelper.NAME, null); adapter.changeCursor(cursor); // change cursor in adapter so that listview changes .getReadableDatabase() .rawQuery("SELECT * FROM " + DatabaseHelper.LIST+ " ORDER BY " + DatabaseHelper.LOCATION, null); adapter.changeCursor(cursor);
adapter.changeCursor(c);
/** * Change the cursor and change the column-to-view mappings at the same time. * * @param c The database cursor. Can be null if the cursor is not available yet. * @param from A list of column names representing the data to bind to the UI. Can be null * if the cursor is not available yet. * @param to The views that should display column in the "from" parameter. * These should all be TextViews. The first N views in this list * are given the values of the first N columns in the from * parameter. Can be null if the cursor is not available yet. */ @Implementation public void changeCursorAndColumns(Cursor c, String[] from, int[] to) { mOriginalFrom = from; mTo = to; realSimpleCursorAdapter.changeCursor(c); findColumns(mOriginalFrom); }
adapter.changeCursor(cur);
private void showUnsent() { mShowUnsent = true; Cursor c = mShowUnsent ? getUnsentCursor() : getAllCursor(); Cursor old = mInstances.getCursor(); try { mInstances.changeCursor(c); } finally { if (old != null) { old.close(); this.stopManagingCursor(old); } } getListView().invalidate(); }
private void showAll() { mShowUnsent = false; Cursor c = mShowUnsent ? getUnsentCursor() : getAllCursor(); Cursor old = mInstances.getCursor(); try { mInstances.changeCursor(c); } finally { if (old != null) { old.close(); this.stopManagingCursor(old); } } getListView().invalidate(); }
/** * Updates whole list. */ private void updateList() { updateTitle(); updateFilterStatus(); if (mCursor != null) { stopManagingCursor(mCursor); } mCursor = mDatabase.getSudokuList(mFolderID, mListFilter); startManagingCursor(mCursor); mAdapter.changeCursor(mCursor); }
adapter.changeCursor(database.getAllNames());