I have a custom adapter derived from ArrayAdapter
that overrides getView()
that we'll call CustomObjectAdapter
. I manually add View
s created by the adapter to a LinearLayout like below:
m_adapter = new CustomObjectAdapter(this.getApplicationContext(),
R.layout.custom_object_layout,
m_customObjectArrayList);
m_linearLayout = (LinearLayout)findViewById(R.id.custom_object_list_linear_layout);
for (int i = 0; i < m_adapter.getCount(); i++) {
// Create the view for the custom object
View view = m_adapter.getView(i, null, null);
m_linearLayout.addView(view);
}
I populate a LinearLayout
with View
s instead of using a ListView
, because I it's contained within a Fragment
in which I want the entire area to be scrollable--rather than just the area within the ListView
. I found this solution in this StackOverflow question: Using a ListAdapter to fill a LinearLayout inside a ScrollView layout.
In the same class that these View
s get populated, the data used in the adapter's getView()
method is updated and then I call m_adapter.notifyDataSetChanged()
. The getView()
function is not getting called subsequently, however. In another area of the code I am updating a adapter that's hooked up to a ListView
in the same manner (instead of a LinearLayout
), and it is updating appropriately. Does anyone know what I'm doing wrong?