Skip to content

Commit 4ca99e9

Browse files
committed
Minor enhancements in the ArrayAdaper example implementation
1 parent a6c0176 commit 4ca99e9

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

de.vogella.android.listactivity/src/de/vogella/android/listactivity/MyListActivity.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ public void onCreate(Bundle icicle) {
2828
"WebOS", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2",
2929
"Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2", "Ubuntu",
3030
"Windows7", "Max OS X", "Linux", "OS/2" };
31-
InteractiveArrayAdapter adapter = new InteractiveArrayAdapter(this,
32-
getModel());
33-
// TwoLayoutsArrayAdapter adapter = new TwoLayoutsArrayAdapter(this,
34-
// values);
31+
// MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this,values);
32+
TwoLayoutsArrayAdapter adapter = new TwoLayoutsArrayAdapter(this,
33+
values);
3534
setListAdapter(adapter);
3635
}
3736

de.vogella.android.listactivity/src/de/vogella/android/listactivity/MySimpleArrayAdapter.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ public MySimpleArrayAdapter(Context context, String[] values) {
1818
this.values = values;
1919
}
2020

21-
2221
@Override
2322
public View getView(int position, View convertView, ViewGroup parent) {
2423
View rowView = null;
25-
LayoutInflater inflater = (LayoutInflater) context
26-
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
27-
rowView = inflater.inflate(R.layout.rowlayout, parent, false);
28-
TextView textView = (TextView) rowView.findViewById(R.id.label);
29-
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
30-
// Change the icon for Windows and iPhone
24+
LayoutInflater inflater = (LayoutInflater) context
25+
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
26+
rowView = inflater.inflate(R.layout.rowlayout, parent, false);
27+
TextView textView = (TextView) rowView.findViewById(R.id.label);
28+
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
29+
// Change the icon for Windows and iPhone
3130

3231
String s = values[position];
3332
textView.setText(s);

0 commit comments

Comments
 (0)