Android添加书签(二)(20)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-26 22:12 点击:次
}
/**
* Get the row id associated with the specified position in the list.
*
* @param position
* Index of the item whose row id we want.
* @return The id of the item at the specified position.
*/
public long getItemId(int position) {
return position;
}
int mCurrentSelection = -1;
public void setSelected(int position) {
mCurrentSelection = position;
notifyDataSetInvalidated();
}
/**
* Get a View that displays the data at the specified position in the list.
*
* @param position
* Index of the item whose view we want.
* @return A View corresponding to the data at the specified position.
*/
public View getView(int position, View convertView, ViewGroup parent) {
if (!mDataValid) {
throw new IllegalStateException(
"this should only be called when the cursor is valid");
}
if (position < 0 || position > mCount) {
throw new AssertionError(
"BrowserBookmarksAdapter tried to get a view out of range");
}
if (convertView == null) {
convertView = new BookmarkItem(mBookmarker);
}
bind((BookmarkItem) convertView, position);
if (position == mCurrentSelection) {
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>