I got my answer, thanks to @Luksprog. For those who might have problems like this, here is the simple solution:
You cannot use this version of the inflate
method:
View row = inflater.inflate(R.layout.contactsdb, parent);
because this will add the inflated View to the parent, which isn't allowed in a ListView
. Instead use this version:
View row = inflater.inflate(R.layout.contactsdb, parent, false);
which will inflate the view but will not add it to the parent. This version is important because it will provide the proper LayoutParams
for your inflated view.