Note that there are some explanatory texts on larger screens.

plurals
  1. POnotifyDataSetChanged() does not call getView() on adapter that draws to a LinearLayout
    primarykey
    data
    text
    <p>I have a custom adapter derived from <code>ArrayAdapter</code> that overrides <code>getView()</code> that we'll call <code>CustomObjectAdapter</code>. I manually add <code>View</code>s created by the adapter to a LinearLayout like below:</p> <pre><code>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 &lt; m_adapter.getCount(); i++) { // Create the view for the custom object View view = m_adapter.getView(i, null, null); m_linearLayout.addView(view); } </code></pre> <p>I populate a <code>LinearLayout</code> with <code>View</code>s instead of using a <code>ListView</code>, because I it's contained within a <code>Fragment</code> in which I want the entire area to be scrollable--rather than just the area within the <code>ListView</code>. I found this solution in this StackOverflow question: <a href="https://stackoverflow.com/questions/12405575/using-a-listadapter-to-fill-a-linearlayout-inside-a-scrollview-layout">Using a ListAdapter to fill a LinearLayout inside a ScrollView layout</a>.</p> <p>In the same class that these <code>View</code>s get populated, the data used in the adapter's <code>getView()</code> method is updated and then I call <code>m_adapter.notifyDataSetChanged()</code>. The <code>getView()</code> function is not getting called subsequently, however. In another area of the code I am updating a adapter that's hooked up to a <code>ListView</code> in the same manner (instead of a <code>LinearLayout</code>), and it is updating appropriately. Does anyone know what I'm doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload