我想在onLoadFinished方法的ListFragment中设置选择,但Log.v(TAG,“onLoadFinished:Selected id - >”+ getSelectedItemId()); line return 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());
}
}
谢谢!