本文整理匯總了Java中android.widget.CursorAdapter.changeCursor方法的典型用法代碼示例。如果您正苦於以下問題:Java CursorAdapter.changeCursor方法的具體用法?Java CursorAdapter.changeCursor怎麽用?Java CursorAdapter.changeCursor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.CursorAdapter
的用法示例。
在下文中一共展示了CursorAdapter.changeCursor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onRestart
import android.widget.CursorAdapter; //導入方法依賴的package包/類
@Override
public void onRestart() {
super.onRestart();
try {
StarbuzzDatabaseHelper starbuzzDatabaseHelper = new StarbuzzDatabaseHelper(this);
db = starbuzzDatabaseHelper.getReadableDatabase();
Cursor newCursor = db.query("DRINK",
new String[] { "_id", "NAME"},
"FAVORITE = 1",
null, null, null, null);
ListView listFavorites = (ListView)findViewById(R.id.list_favorites);
CursorAdapter adapter = (CursorAdapter) listFavorites.getAdapter();
adapter.changeCursor(newCursor);
favoritesCursor = newCursor;
} catch(SQLiteException e) {
Toast toast = Toast.makeText(this, "Database unavailable", Toast.LENGTH_SHORT);
toast.show();
}
}
示例2: onViewRecycled
import android.widget.CursorAdapter; //導入方法依賴的package包/類
@Override
public void onViewRecycled(ViewHolder holder) {
super.onViewRecycled(holder);
CursorAdapter adapter = (CursorAdapter) holder.lvAccess.getAdapter();
if (adapter != null) {
Log.i(TAG, "Closing access cursor");
adapter.changeCursor(null);
holder.lvAccess.setAdapter(null);
}
}
示例3: onCursorLoaded
import android.widget.CursorAdapter; //導入方法依賴的package包/類
@Override
public void onCursorLoaded(Cursor c){
CursorAdapter adapter = (CursorAdapter)mList.getAdapter();
adapter.changeCursor(c);
mList.setAdapter(adapter);
}