android.widget.SimpleCursorAdapter.changeCursor()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中android.widget.SimpleCursorAdapter.changeCursor()方法的一些代码示例,展示了SimpleCursorAdapter.changeCursor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SimpleCursorAdapter.changeCursor()方法的具体详情如下:
包路径:android.widget.SimpleCursorAdapter
类名称:SimpleCursorAdapter
方法名:changeCursor

SimpleCursorAdapter.changeCursor介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Subscribe(sticky = true, threadMode =ThreadMode.MAIN)
public void onModelLoaded(ModelLoadedEvent event) {
 ((SimpleCursorAdapter)getListAdapter()).changeCursor(event.model);
 if (sv!=null) {
  sv.setEnabled(true);
 }
}

代码示例来源:origin: robolectric/robolectric

@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);
}

代码示例来源:origin: dsolonenko/financisto

public void onDestroy() {
    if (filterAdapter != null) {
      filterAdapter.changeCursor(null);
      filterAdapter = null;
    }
  }
}

代码示例来源:origin: dsolonenko/financisto

public void onDestroy() {
  if (autoCompleteAdapter != null) {
    autoCompleteAdapter.changeCursor(null);
    autoCompleteAdapter = null;
  }
}

代码示例来源:origin: be.e_contract.jwatchdog/jwatchdog-android

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
  this.simpleCursorAdapter.changeCursor(cursor);
}

代码示例来源:origin: stackoverflow.com

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());

}

代码示例来源:origin: Rachel-Ding/Android-Tiny-Projects

private void refreshListView() {
    c = dbRead.query("user", null, null, null, null, null, null);
    adapter.changeCursor(c);
//        c.close();
  }

代码示例来源:origin: stackoverflow.com

adapter.changeCursor(updatedCursor);

代码示例来源:origin: stackoverflow.com

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);
  }
});

代码示例来源:origin: org.robolectric/shadows-core

@Implementation
public void changeCursorAndColumns(Cursor c, String[] from, int[] to) {
 mOriginalFrom = from;
 mTo = to;
 realSimpleCursorAdapter.changeCursor(c);
 findColumns(mOriginalFrom);
}

代码示例来源:origin: com.github.japgolly.android.test/robolectric

@Implementation
public void changeCursor(Cursor c) {
  realSimpleCursorAdapter.changeCursor(c);
  // rescan columns in case cursor layout is different
  findColumns(mOriginalFrom);
}

代码示例来源:origin: org.robolectric/shadows-core-v23

@Implementation
public void changeCursorAndColumns(Cursor c, String[] from, int[] to) {
 mOriginalFrom = from;
 mTo = to;
 realSimpleCursorAdapter.changeCursor(c);
 findColumns(mOriginalFrom);
}

代码示例来源:origin: stackoverflow.com

.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);

代码示例来源:origin: stackoverflow.com

adapter.changeCursor(c);

代码示例来源:origin: com.github.japgolly.android.test/robolectric

/**
 * 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);
}

代码示例来源:origin: stackoverflow.com

adapter.changeCursor(cur);

代码示例来源:origin: GeoODK/collect

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();
}

代码示例来源:origin: GeoODK/collect

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();
}

代码示例来源:origin: ogarcia/opensudoku

/**
 * Updates whole list.
 */
private void updateList() {
  updateTitle();
  updateFilterStatus();
  if (mCursor != null) {
    stopManagingCursor(mCursor);
  }
  mCursor = mDatabase.getSudokuList(mFolderID, mListFilter);
  startManagingCursor(mCursor);
  mAdapter.changeCursor(mCursor);
}

代码示例来源:origin: stackoverflow.com

adapter.changeCursor(database.getAllNames());

相关文章