title: Using different views in onCreateViewHolder
body: <p>I followed <a href="https://www.youtube.com/watch?v=LZCZSeFTvyk" rel="nofollow noreferrer">this</a> tutorial by Google Developer's YouTube channel to implement AdMob native express ads.</p>
  
  <p>I got the following error:</p>
  
  <pre><code>required: packagename.adapter.viewHolder
  found   : packagename.adapter.NativeExpressAdViewHolder
  </code></pre>
  
  <p>Here is how my <code>onCreateViewHolder</code> look like:</p>
  
  <pre><code>public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      switch (viewType) {
          case AD_VIEW_TYPE:
              View nativeExpressLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.native_express_add_container, parent, false);
              return new NativeExpressAdViewHolder(nativeExpressLayoutView); 
          case MENU_ITEM_VIEW_TYPE:
              default:
              View myLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list, parent, false);
              return new ViewHolder(myLayoutView);
      }
  }
  </code></pre>
  
  <p>and here is my 2 different ViewHolder classes:</p>
  
  <pre><code>class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {      
  
      ViewHolder(View itemView) {
          super(itemView);
      }          
  }
  
  public class NativeExpressAdViewHolder extends RecyclerView.ViewHolder {
      NativeExpressAdViewHolder(View view) {
          super(view);
      }
  }
  </code></pre>
  
  <p>Here is simular questions with no answers:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/46140421/error-incompatible-types-while-adding-nativeads-in-recyclerview">Error &quot;Incompatible types&quot; while adding NativeAds in recyclerView</a></li>
  <li><a href="https://stackoverflow.com/questions/45913734/how-to-add-nativeexpressadview-with-custom-model-list-android">How to add NativeExpressAdView with Custom Model List Android?</a></li>
  </ul>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here is my full adapter as requested:</p>
  
  <pre><code>public class MainActivityVideoAdapter extends Adapter&lt;MainActivityVideoAdapter.ViewHolder&gt; {
  ArrayList&lt;Bitmap&gt; bitmapArrayList;
  Context context;
  LayoutInflater layoutInflater;
  View myLayoutView;
  ArrayList&lt;PathModel&gt; ThumbPathList;
  ArrayList&lt;PathModel&gt; VideoPathList = new ArrayList();
  static DBManager manager;
  long _id;
  
  private static final int MENU_ITEM_VIEW_TYPE = 0;
  private static final int AD_VIEW_TYPE = 1;
  
  class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
      //Video Title
      TextView videoName;
      //Video Image
      CircularImageView videoThumb;
      //PopupMenu
      ImageButton viewholderOtions;
  
      ViewHolder(View itemView) {
          super(itemView);
          viewholderOtions = (ImageButton) myLayoutView.findViewById(R.id.viewholderOptions);
          videoName = (TextView) myLayoutView.findViewById(R.id.FilePath);
          videoThumb = (CircularImageView) myLayoutView.findViewById(R.id.VideoThumbnail);
          //View onClick
          itemView.setOnClickListener(this);
          //Popup onClick
          viewholderOtions.setOnClickListener(this);
      }
  
  
      //Handling click events
      @Override
      public void onClick(View v) {
          if (v == viewholderOtions) {
  
              int position = (int) v.getTag();
  
              showPopupMenu(viewholderOtions, position);
          }
  
      }
  }
  
  public class NativeExpressAdViewHolder extends RecyclerView.ViewHolder {
      NativeExpressAdViewHolder(View view) {
          super(view);
      }
  }
  
  public MainActivityVideoAdapter(Context context, ArrayList&lt;PathModel&gt; ThumbPathList, ArrayList&lt;PathModel&gt; VideoPathList) {
      this.context = context;
      this.ThumbPathList = ThumbPathList;
      this.VideoPathList = VideoPathList;
  }
  
  public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      switch (viewType) {
          case AD_VIEW_TYPE:
              View nativeExpressLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.native_express_add_container, parent, false);
              return new NativeExpressAdViewHolder(nativeExpressLayoutView);
          case MENU_ITEM_VIEW_TYPE:
          default:
              View myLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list, parent, false);
              return new ViewHolder(myLayoutView);
      }
  }
  
  public void onBindViewHolder(final ViewHolder myHolder, final int position) {
      int viewType = getItemViewType(position);
      switch (viewType) {
          case AD_VIEW_TYPE:
  
          case MENU_ITEM_VIEW_TYPE:
          default:
  
              final PathModel videoPathModel = this.VideoPathList.get(position);
              PathModel thumbathModel = this.ThumbPathList.get(position);
              File file = new File(videoPathModel.getPath());
              String filename = file.getName();
              myHolder.videoName.setText(filename);
              myHolder.videoThumb.setImageURI(Uri.parse(thumbathModel.getPath()));
              myHolder.viewholderOtions.setTag(position);
  
              myHolder.itemView.setOnClickListener(new View.OnClickListener() {
  
  
                  @Override
                  public void onClick(View v) {                
                  Intent intent= new Intent(context, VideoPlayerActivity.class);              
                  intent.putExtra("fromFA2", "fromFA2");
                  context.startActivity(intent);
  
  
  
                  }
  
  
              });
  
      }
  
  
  }
  </code></pre>