sp; address.setType(MainActivity.this.getString(R.string.delivery));
break;
}
Toast.makeText(MainActivity.this, address.toString(), Toast.LENGTH_SHORT)
.show();
adapter.add(address);
}
});
lv_address = (ListView) findViewById(R.id.lv_address);
Log.d(TAG, "设置 Fancy List Item");
this.adapter = new ArrayAdapter<Address>(MainActivity.this, R.layout.fancy_list_item, listAddress);
lv_address.setAdapter(this.adapter);
}
class AddressAdapter extends ArrayAdapter<Address> {
public AddressAdapter() {
super(MainActivity.this, R.layout.fancy_list_item, listAddress);
Log.d(TAG, "构造Fancy List Item");
}
@Override
public int getCount() {
return super.getCount();
}
@Override
public long getItemId(int position) {
return super.getItemId(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//return super.getView(position, convertView, parent);
View rowView = convertView;
AddressHolder holder = null;
if (rowView == null) {
Log.d(TAG, "位置" + position + ";开始加载View");
LayoutInflater layoutInflater = getLayoutInflater();
rowView = layoutInflater.inflate(R.layout.fancy_list_item, parent, false);
Log.d(TAG, "位置" + position + ";开始加载完成");
holder = new AddressHolder(rowView);
Log.d(TAG, "位置" + position + ";设置完成");
rowView.setTag(holder);
} else {
holder = (AddressHolder) rowView.getTag();
}
holder.populateFrom(listAddress.get(position));
return (rowView);
}
}
static class AddressHolder {
private TextView name = null;
private TextView address = null;
private ImageView icon = null;
private View rowView = null;
AddressHolder(View r
上一页 [1] [2] [3] [4] 下一页