title: Error: incompatible types: View cannot be converted to RecyclerView
body: <p>I'm new to android programming. I'm trying to make a single page app with a list of videos which I can scroll and do so, I am using RecyclerView. In my activity, it says a view cannot be converted to RecyclerView and as far as I know, RecyclerView does not have any widgets. What should I do? I will attach my code.</p>
  
  <p>My activity:</p>
  
  <pre><code>package com.arvindsudheer.youtubeplayertesting;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  
  /**
   * Created by ArvindSudheer on 6/10/2017.
   */
  
  class RecyclerView {
  
  
  public LinearLayoutManager layoutManager;
  public MyAdapter adapter;
  public boolean hasFixedSize;
  
  private void setLayoutManager(LinearLayoutManager layoutManager) {
      this.layoutManager = layoutManager;
  }
  
  private void setAdapter(MyAdapter adapter) {
      this.adapter = adapter;
  }
  
  private void setHasFixedSize(boolean hasFixedSize) {
      this.hasFixedSize = hasFixedSize;
  }
  
  /**
   * Created by ArvindSudheer on 6/9/2017.
   */
  
  public class MyActivity extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.childview1);
          RecyclerView recyclerView=(RecyclerView)findViewById(R.id.list);
          recyclerView.setHasFixedSize(true);
          //to use RecycleView, you need a layout manager. default is 
  LinearLayoutManager
          LinearLayoutManager linearLayoutManager=new 
  LinearLayoutManager(this);
          linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
          recyclerView.setLayoutManager(linearLayoutManager);
          MyAdapter adapter=new MyAdapter(MyActivity.this);
          recyclerView.setAdapter(adapter);
      }
  }
  }
  </code></pre>
  
  <p>MY Adapter:</p>
  
  <pre><code>    package com.arvindsudheer.youtubeplayertesting;
  
      import android.app.Activity;
      import android.content.Context;
      import android.content.Intent;
      import android.support.v7.widget.RecyclerView;
      import android.view.LayoutInflater;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.ImageView;
      import android.widget.RelativeLayout;
  
      import com.google.android.youtube.player.YouTubeInitializationResult;
      import com.google.android.youtube.player.YouTubeStandalonePlayer;
      import com.google.android.youtube.player.YouTubeThumbnailLoader;
      import com.google.android.youtube.player.YouTubeThumbnailView;
  
      public class MyAdapter extends RecyclerView.Adapter&lt;MyAdapter.VideoInfoHolder&gt; {
  
      //these ids are the unique id for each video
      String[] VideoID = {"kN6lRqzmcOY", "MzmSFocMdJk", "L3LixkCN5tM","EuNaQCUjtCw","d-I2JSlEKtA","rwSf_12aMfE","13HIRNVFRlk","BH5_7IYvcVE","Lxc8-INx5G0","iwE8foegHkM","kCKUZdqo600","dr36AF4MqjY","IrMLXTw0528","gyxgVsXMYq0","71MTp2Ley3U","oeNRrGaGV20","loxMW2honqw","Sv63K3ESstA","7U8NzRAvy-I","2kdcR1QBqAI","n3w5c2VYcoU","2zA8W7h7ays","qfkbvujyPpc","JVF8pE1KxaA","f0bi0yl7uZU","5DbdWFAs8EI","5DbdWFAs8EI","2BFUvmCrn1o","yuYbVcoq9nk","lkFlQ5ECM8Q","JuYrl_49WA4","r3L87CUTxeU","RJMvq0pgvkg","9TuDEhfOLUc","HFTTDvuPMOs","fHRh1ksUOJg","OW7Gwuz8vTU","NitQnVpvzd4","-QOEEyuKPMY"};
      Context ctx;
  
      public MyAdapter(Context context) {
          this.ctx = context;
      }
  
      @Override
      public VideoInfoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.my_list_view, parent, false);
          return new VideoInfoHolder(itemView);
      }
  
      @Override
      public void onBindViewHolder(final VideoInfoHolder holder, final int position) {
  
  
          final YouTubeThumbnailLoader.OnThumbnailLoadedListener  onThumbnailLoadedListener = new YouTubeThumbnailLoader.OnThumbnailLoadedListener(){
              @Override
              public void onThumbnailError(YouTubeThumbnailView youTubeThumbnailView, YouTubeThumbnailLoader.ErrorReason errorReason) {
  
              }
  
              @Override
              public void onThumbnailLoaded(YouTubeThumbnailView youTubeThumbnailView, String s) {
                  youTubeThumbnailView.setVisibility(View.VISIBLE);
                  holder.relativeLayoutOverYouTubeThumbnailView.setVisibility(View.VISIBLE);
              }
          };
  
          holder.youTubeThumbnailView.initialize(Resource.KEY, new YouTubeThumbnailView.OnInitializedListener() {
              @Override
              public void onInitializationSuccess(YouTubeThumbnailView youTubeThumbnailView, YouTubeThumbnailLoader youTubeThumbnailLoader) {
  
                  youTubeThumbnailLoader.setVideo(VideoID[position]);
                  youTubeThumbnailLoader.setOnThumbnailLoadedListener(onThumbnailLoadedListener);
              }
  
              @Override
              public void onInitializationFailure(YouTubeThumbnailView youTubeThumbnailView, YouTubeInitializationResult youTubeInitializationResult) {
                  //write something for failure
              }
          });
      }
  
      @Override
      public int getItemCount() {
          return VideoID.length;
      }
  
      public class VideoInfoHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
  
          protected RelativeLayout relativeLayoutOverYouTubeThumbnailView;
          YouTubeThumbnailView youTubeThumbnailView;
          protected ImageView playButton;
  
          public VideoInfoHolder(View itemView) {
              super(itemView);
              playButton=(ImageView)itemView.findViewById(R.id.btnYoutube_player);
              playButton.setOnClickListener(this);
              relativeLayoutOverYouTubeThumbnailView = (RelativeLayout) itemView.findViewById(R.id.relativeLayout_over_youtube_thumbnail);
              youTubeThumbnailView = (YouTubeThumbnailView) itemView.findViewById(R.id.youtube_thumbnail);
          }
  
          @Override
          public void onClick(View v) {
  
              Intent intent = YouTubeStandalonePlayer.createVideoIntent((Activity) ctx, Resource.KEY, VideoID[getLayoutPosition()]);
              ctx.startActivity(intent);
          }
  
  
  
      }
  
      private class Resource {
          public static final String KEY = "AIzaSyDOv0yWBimW8L8zIiYfTDYH9_9jFpZWgEw";
      }
      }
  </code></pre>
  
  <p>layout for each item : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/parent_relativeLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
      &lt;android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:card_view="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:clickable="true"
          android:foreground="@drawable/image_ripple"
          card_view:cardCornerRadius="5dp"
          card_view:cardElevation="0dp"
          android:layout_marginTop="10dp"
          card_view:cardBackgroundColor="@android:color/black"
  
          card_view:cardPreventCornerOverlap="false"
          card_view:cardUseCompatPadding="true"&gt;
  
  
          &lt;com.google.android.youtube.player.YouTubeThumbnailView
              android:id="@+id/youtube_thumbnail"
              android:layout_width="match_parent"
              android:layout_height="250dp"
              android:scaleType="centerCrop"
              android:visibility="visible"/&gt;
  
          &lt;RelativeLayout android:id="@+id/relativeLayout_over_youtube_thumbnail"
              android:layout_width="match_parent"
              android:layout_height="250dp"
              android:background="@color/color_background_transparent"
              android:visibility="visible"&gt;
  
              &lt;ImageView android:id="@+id/btnYoutube_player"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:scaleType="center"
                  android:src="@mipmap/ic_youtube_play_button"/&gt;
  
          &lt;/RelativeLayout&gt;
      &lt;/android.support.v7.widget.CardView&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Main Layout :</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical" android:layout_width="match_parent"
   android:layout_height="match_parent"&gt;
   &lt;android.support.v7.widget.RecyclerView
   android:id="@+id/list"
   android:layout_width="match_parent"
   android:layout_height="wrap_content" /&gt;
  
   &lt;/LinearLayout&gt;
  </code></pre>