title: How to add element between listview's items?
body: <p>I wish to insert extra element in my list view.
  E.g I have infinite listview with images, after each 20 images I wish to add webview with link to source page.</p>
  
  <p>According to <a href="https://stackoverflow.com/a/18352864/1551603">sugested</a>
  Unfortunatly recieve NPE on <code>WebView sourse = (WebView) vi.findViewById(R.id.webViewSourse);</code></p>
  
  <pre><code>public class MediaItemAdapter extends BaseAdapter {
  
      private Activity activity;
      private ArrayList&lt;HashMap&lt;String, String&gt;&gt; data;
      private static LayoutInflater inflater = null;
      public ImageLoader imageLoader;
  
      public MediaItemAdapter(Activity a, ArrayList&lt;HashMap&lt;String, String&gt;&gt; d) {
          activity = a;
          data = d;
          inflater = (LayoutInflater) activity
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          imageLoader = new ImageLoader(activity.getApplicationContext());
      }
  
      public int getCount() {
          return data.size();
      }
  
      @Override
      public int getViewTypeCount() {
          return 2; // any number what you need.
      }
  
      @Override
      public int getItemViewType(int position) {
          // view type is managed as zero-based index.
          if (position % 11 != 0)
              return 0;
          else
              return 1;
      }
  
      public Object getItem(int position) {
          return position;
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          View vi = convertView;
  
          if (convertView == null) {
              // View Recycling is managed separately based on its view type,
              // so you don't need to worry about view corruptions.
  
              int type = getItemViewType(position);
              switch (type) {
              case 0:
                  // inflate imageview here.
                  convertView = inflater.inflate(R.layout.item_composer, null);
              case 1:
                  // inflate webview here.
                  convertView = inflater.inflate(R.layout.banner_row, null);
              }
          }
          int type = getItemViewType(position);
          switch (type) {
          case 0:
              // inflate imageview here.
  
              ImageView thumb_image = (ImageView) vi.findViewById(R.id.imagePrev); // thumb
  
  
              String value = add.get("first_photo_url");
              if (value == null || value.trim().length() &lt;= 0
                      || value.equalsIgnoreCase("null")
                      || value.trim().equalsIgnoreCase("")) {
                  thumb_image.setImageResource(R.drawable.stub);
              } else {
                  imageLoader.DisplayImage(add.get("first_photo_url"),
                          thumb_image);
                  // // do nothing
              }
          case 1:
              // inflate webview here.
              WebView sourse = (WebView) vi.findViewById(R.id.webViewSourse);
  
              WebSettings webSettings = sourse.getSettings();
              webSettings.setJavaScriptEnabled(true);
              // banner.loadUrl("http://www.google.com");
              sourse.loadUrl(url);
          }
  
          return vi;
      }
  
  }
  </code></pre>