本文整理匯總了Java中android.support.v4.widget.CursorAdapter.getCursor方法的典型用法代碼示例。如果您正苦於以下問題:Java CursorAdapter.getCursor方法的具體用法?Java CursorAdapter.getCursor怎麽用?Java CursorAdapter.getCursor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.widget.CursorAdapter
的用法示例。
在下文中一共展示了CursorAdapter.getCursor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteAll
import android.support.v4.widget.CursorAdapter; //導入方法依賴的package包/類
private void deleteAll(){
ListView notesList = (ListView) findViewById(R.id.notes_list);
CursorAdapter ca = (CursorAdapter) notesList.getAdapter();
Cursor c = ca.getCursor();
c.moveToPosition(-1);
while (c.moveToNext()){
if (c.getInt(c.getColumnIndexOrThrow(DbContract.NoteEntry.COLUMN_TYPE)) == DbContract.NoteEntry.TYPE_AUDIO) {
String filePath = getFilesDir().getPath()+"/audio_notes" + c.getString(c.getColumnIndexOrThrow(DbContract.NoteEntry.COLUMN_CONTENT));
new File(filePath).delete();
} else if (c.getInt(c.getColumnIndexOrThrow(DbContract.NoteEntry.COLUMN_TYPE)) == DbContract.NoteEntry.TYPE_SKETCH) {
String content = c.getString(c.getColumnIndexOrThrow(DbContract.NoteEntry.COLUMN_CONTENT));
new File(getFilesDir().getPath()+"/sketches"+content).delete();
new File(getFilesDir().getPath()+"/sketches"+content.substring(0, content.length()-3) + "jpg").delete();
}
DbAccess.deleteNote(getBaseContext(), c.getInt(c.getColumnIndexOrThrow(DbContract.NoteEntry.COLUMN_ID)));
}
updateList();
}
示例2: bindViewAtPosition
import android.support.v4.widget.CursorAdapter; //導入方法依賴的package包/類
public void bindViewAtPosition(final int position) {
final CursorAdapter adapter = getCursorAdapter();
final Cursor cursor = adapter.getCursor();
if (cursor != null && cursor.moveToPosition(position)) {
adapter.bindView(getView(), getActivity(), cursor);
}
}