6. MVC - Model
public class ImageAdapter extends BaseAdapter {
private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return 0;
}
// create a new ImageView for each item referenced by the
Adapter
public View getView(int position, View convertView,
ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled,
initialize some attributes
imageView = new ImageView(mContext);
6
7. MVC: all in one
ListActiviy
Ref:
http://www.ideasandroid.com/archives/295
http://developer.android.com/reference/android/app/ListActivity.html
7
Exercise
Write your custom GridActivity
15. Façade
A facade is an object that provides a
simplified interface to a larger body of
code, such as a class library.
wrap a poorly-designed collection of APIs
with a single well-designed API (as per task
needs).
Hide Complexity
App network
ExchangeViewManager
15
17. Bridge
"decouple an abstraction from
its implementation so that the two can
vary independently“
17
Adapter
CursorAdapter
SimpleCursorAdapter
ArrayAdapter
AdapterView
AdapterViewFlipper
ExpandableListView
Gallery