I want to write a ListView in basic format but I get an error:
UnsupportedOperationException: addView(View, LayoutParams) is not supported in Ad
Replace your layout in inflater
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) LayoutInflater
.from(contex);
convertView = inflater.inflate(R.layout.your_layout, parent, false);
}
txtName = (TextView) convertView.findViewById(R.id.txtName);
txtName.setText(""+ContactsArr.get(position).get("ContName"));
txtPhoneNumber = (TextView) convertView.findViewById(R.id.txtContact);
txtPhoneNumber.setText(""+ContactsArr.get(position).get("ContPhone"));
return convertView;
}