title: Change row height of ListView programmatically in Android app
body: <p>I am developing an Android app with ListView.</p>
  
  <p>I would like to change row height programmatically such as the height of row 0 is 100, the one of others is 200.</p>
  
  <p>I am writing down the following code, however at the line <strong>"layoutParams.height = 100;"</strong> I encounter <strong>NullPointerException</strong>.</p>
  
  <p>Could you tell me how to solve this problem?</p>
  
  <pre><code>@Override
  public View getView(int position, View convertView, ViewGroup parent) {
  
      if (mInflater == null){
          mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
      if (null == convertView) {
          convertView = mInflater.inflate(R.layout.list_detail, null);
      }
      if (imageLoader == null) imageLoader = AppController.getInstance().getImageLoader();
  
      if(position==0){
          ViewGroup.LayoutParams layoutParams = convertView.getLayoutParams();
          layoutParams.height = 100;
          convertView.setLayoutParams(layoutParams);
      }
      else{
          ViewGroup.LayoutParams layoutParams = convertView.getLayoutParams();
          layoutParams.height = 200;
          convertView.setLayoutParams(layoutParams);
      }
  
      ・・・
  
      return convertView;
  }
  </code></pre>