title: Getting Custom List Adapter to properly inflate multiple linear layouts
body: <p>I'm a little new to android and am trying to figure out these custom list adapter. So I have an activity that extends BaseListActivity and a function like:</p>
  
  <pre><code>public void inflate(){
  
      ArrayList&lt;String&gt; words = new ArrayList&lt;String&gt;();
      orders.add("hello");
      orders.add("world");
  
      wordsList = (ListView) findViewById(R.id.list);
  
      WordsAdapter adapter = new WordsAdapter(this, R.layout.single_word_container_item,words);
      wordsList.setAdapter(adapter);
  </code></pre>
  
  <p>And then I implement my custom WordsAdapter as follows:</p>
  
  <pre><code>public class WordsAdapter extends ArrayAdapter&lt;String&gt;{
      public Context context;
      public ArrayList&lt;String&gt; _words;
  
      //not sure the purpose of 'a' here
      public WordsAdapter(Context context, int a, ArrayList&lt;String&gt; words) {
          super(context, a, words);
          _words = words;
          this.context = context;
      }
  
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View v = inflater.inflate(R.layout.single_word_container_item, null);
          TextView wordName = (TextView) findViewById(R.id.wordName);
          if(!_words.isEmpty()){
              wordName.setText(_word.remove(0));
          }
  
          return v;
      }
  
  }
  </code></pre>
  
  <p>From what I can tell from the logs is that getView is never being called. 'single_word_container_item' is simply an xml file with a layout that I want to inflate multiple times. I'm not sure about the entire process - I figured you set an adapter on your listview and then in that adapter you take care of displaying what will actually show up each time, so what am I doing wrong here? Currently I'm getting a null pointer exception where I set my adapter but earlier it just would not show anything. The logs show that it is getting into the WordsAdapter constructor but then dying. Thanks in advance for any advice.</p>
  
  <p>EDIT: So it appears to be something wrong with identifying the listview in my xml.  </p>
  
  <p>If you use: </p>
  
  <pre><code>ListView
  android:id="@+id/android:list" OR android:id="@id/android:list"
  android:layout_width="match_parent"
  android:layout_height="wrap_content" 
  ListView
  </code></pre>
  
  <p>the error is a null pointer exception when you use it</p>
  
  <p>but if you define it as:</p>
  
  <pre><code>ListView
  android:id="@+id/list"
  android:layout_width="match_parent"
  android:layout_height="wrap_content" 
  ListView
  </code></pre>
  
  <p>you get the error: 07-15 19:18:50.240: E/AndroidRuntime(29842): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'</p>
  
  <p>EDIT: So apparently you can't extend listactivity and call setcontentview().  Since I need a view on top of the listview I don't want to extend list activity but rather call setcontentview and just refer to the list by its id. </p>
  
  <p>Now my error is:</p>
  
  <p>java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. </p>
  
  <p>I tried calling adapter.notifyDataSetChanged() after my setAdapter() but that didn't seem to work. Am I supposed to call it somewhere else? </p>