カスタム リストビューがあり、条件に応じて戻りたい/膨らませたい。条件によって行を表示したり非表示にしたりしたい。
getView() には次のものがあります
if (convertView == null) {
// Inflate the layout
LayoutInflater li = getLayoutInflater();
convertView = li.inflate(
R.layout.contactos_list_item, null);
contactViewHolder = new ContactViewHolder();
contactViewHolder.imgContact = (ImageView) convertView
.findViewById(R.id.flag);
contactViewHolder.txtViewContactName = (TextView) convertView
.findViewById(R.id.txtView_name);
contactViewHolder.txtViewPhoneNumber = (TextView) convertView
.findViewById(R.id.txtview_number);
convertView.setTag(contactViewHolder);
} else {
contactViewHolder = (ContactViewHolder) convertView.getTag();
}
そして帰りたい
if(condition)
{
return convertView;
}
else
{
LayoutInflater li = getLayoutInflater();
convertView=li.inflate(R.layout.row_null,null);
return convertView;
}
適切な xml レイアウトがありますが、アプリケーションが動作しなくなります。何を変えるべきですか?