How can adapter display the content of the listview.
1.AbsListView.java
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
.......
final View child = obtainView(0, mIsScrap);
.....
}
//one item, called one time.2.AbsListView.java
View obtainView(int position, boolean[] isScrap) {
....
child = mAdapter.getView(position, scrapView, this);
....
}
3.CursorAdapter.java
public View getView(int position, View convertView, ViewGroup parent) {
.....
if (convertView == null) {
v = newView(mContext, mCursor, parent);
} else {
v = convertView;
}
bindView(v, mContext, mCursor);
return v;
}
4.CursorAdapter.java
public abstract void bindView(View view, Context context, Cursor cursor);
public abstract View newView(Context context, Cursor cursor, ViewGroup parent);
//so override the the bindView and newView. and we just need the return the item view not the listview.
all adapters getView
View getView(int position, View convertView, ViewGroup parent);
so for what adapter, we just need to return one item's view.
file to url
public static Uri fromFile(File file) {
if (file == null) {
throw new NullPointerException("file");
}
PathPart path = PathPart.fromDecoded(file.getAbsolutePath());
return new HierarchicalUri(
"file", Part.EMPTY, path, Part.NULL, Part.NULL);
}