我想在 onLoadFinished 方法的 ListFragment 中设置选择,但是 Log.v(TAG, " onLoadFinished: Selected id -> " + getSelectedItemId()); 行返回 onLoadFinished: Selected id -> -9223372036854775808 ?
有什么问题?
public void onLoadFinished(Loader<LoaderResult> loader, LoaderResult data) {
adapter.swapCursor(data.cursor);
// The list should now be shown.
if (isResumed()) {
setListShown(true);
} else {
setListShownNoAnimation(true);
}
if (data.cursor.getCount() > 0) {
setSelection(0);
Log.v(TAG, " onLoadFinished: Selected id -> " + getSelectedItemId());
}
}
谢谢!