title: Unable to use LayoutInflater in custom adapter
body: <p>I'm looking into writing a custom adapter to populate a listview with 3 textviews per line. I've found quite a bit of example code to do this, but the one that seemed the best was at: <a href="http://www.anddev.org/custom_widget_adapters-t1796.html" rel="nofollow noreferrer">http://www.anddev.org/custom_widget_adapters-t1796.html</a></p>
  
  <p>After a few minor tweaks to fix some compiler issues with the latest Android SDK, I got it running, only to get the exception:</p>
  
  <blockquote>
    <p>ERROR/AndroidRuntime(281): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView</p>
  </blockquote>
  
  <p>So I did a lot of research and found lots of possible reasons and fixes for this. None of which changed a thing. My adapter code is currently:</p>
  
  <pre><code>public class WeatherAdapter extends BaseAdapter {
  
      private Context context;
      private List&lt;Weather&gt; weatherList;
  
      public WeatherAdapter(Context context, int rowResID,
                          List&lt;Weather&gt; weatherList ) { 
          this.context = context;
          this.weatherList = weatherList;
      }
  
      public int getCount() {                        
          return weatherList.size();
      }
  
      public Object getItem(int position) {     
          return weatherList.get(position);
      }
  
      public long getItemId(int position) {  
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) { 
          Weather weather = weatherList.get(position);
  
          //LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          LayoutInflater inflater = LayoutInflater.from(context);
  
          View v = inflater.inflate(R.layout.weather_row, null, true);
          TextView cityControl = (TextView)v.findViewById( R.id.city );
          TextView temperatureControl = (TextView)v.findViewById( R.id.temperature );
          ImageView skyControl = (ImageView)v.findViewById( R.id.sky );
          return v;
      }
  
  }
  </code></pre>
  
  <p>So I have tried the commented out way of getting the inflater, and the currently uncommented out. I have tried passing "parent" to inflate as well as null, and passing "true", "false" and omitting completely the last parameter.  None of them have worked, and all examples I've found so far have been from 2008 which I get the feeling are a bit outdated.</p>
  
  <p>If anyone could help with this then I would love to resolve the issue.</p>