title: How to get a video to play in a recyclerview?
body: <p>I have spent all day trying to figure this out using libraries and everything but I can't seem to implement a feature that would seem easy.</p>
  <p>My end goal here is to get videos to display in a recyclerview as this part of my app will have a 'videos' section.</p>
  <p>I will attach my current code and if anyone could help i'd appreciate it all I am really using here is intent extras to get and pull data.</p>
  <p>Adapter.java</p>
  <pre><code>public class WerecommendAdapter extends RecyclerView.Adapter&lt;WerecommendAdapter.MyHolder&gt; {
  
  private final List&lt;Businesses&gt; mData;
  private Context mcontext;
  private CategoryCardActivity cca;
  
  
  public WerecommendAdapter(Context mcontext, List&lt;Businesses&gt; mData) {
      this.mData = mData;
      this.mcontext = mcontext;
  }
  
  public WerecommendAdapter.MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
      mcontext = parent.getContext ();
      View view = LayoutInflater.from ( mcontext ).inflate ( R.layout.recommend_card_design,
              parent, false );
  
  
      return new WerecommendAdapter.MyHolder ( view );
  }
  
  @Override
  public void onBindViewHolder(@NonNull MyHolder holder, int position) {
  
      Businesses temp = mData.get ( position );
      // Dymamically Generating card background colours
      Random rnd = new Random ();
      int currentColour = Color.argb ( 255, rnd.nextInt ( 256 ), rnd.nextInt ( 256 ), rnd.nextInt ( 256 ) );
      holder.cardview.setBackgroundColor ( currentColour );
  
      holder.businessname.setText ( mData.get ( position ).getBusiness_name () );
      Glide.with ( mcontext )
              .asBitmap ()
              .load ( mData.get ( position ).getBusiness_img () )
              .diskCacheStrategy ( DiskCacheStrategy.ALL )
              .into ( holder.businesslogo );
      holder.cardview.setOnClickListener ( v -&gt; {
          Intent intent = new Intent ( mcontext, Solocompany.class );
          intent.putExtra ( &quot;bus_name&quot;, temp.getBusiness_name () );
          intent.putExtra ( &quot;bdesc&quot;, temp.getBdesc () );
          intent.putExtra ( &quot;Image_URL&quot;, temp.getBusiness_img () );
          intent.putExtra ( &quot;contact&quot;, temp.getContact () );
          intent.putExtra ( &quot;website&quot;, temp.getBusiness_website () );
          intent.putExtra ( &quot;website_social&quot;, temp.getBusiness_website_social () );
          intent.putExtra ( &quot;careers&quot;, temp.getCareers () );
          intent.putExtra ( &quot;videos&quot;, temp.getVideos () );
          mcontext.startActivity ( intent );
  
          } );
  
  
  }
  
  @Override
  public int getItemCount() {
      cca = new CategoryCardActivity ();
      return mData.size ();
  }
  
  
  public class MyHolder extends RecyclerView.ViewHolder {
  
      TextView category;
      RelativeLayout werecommend;
      TextView businessname;
      ImageView businesslogo;
      LinearLayout cardview;
  
      VideoView videoView;
  
  
  
      public MyHolder(@NonNull View itemView) {
          super ( itemView );
          category = itemView.findViewById ( R.id.category );
          werecommend = itemView.findViewById ( R.id.werecommendrecycler );
          businessname = itemView.findViewById ( R.id.businessname );
          businesslogo = itemView.findViewById ( R.id.business_image );
          cardview = itemView.findViewById ( R.id.cardview );
          videoView = itemView.findViewById ( R.id.videorecycler );
  
  
  
      }
  }
  </code></pre>
  <p>}</p>
  <p>Where Intent goes ----&gt;</p>
  <pre><code>public class Solocompany extends AppCompatActivity {
  private static final String TAG = &quot;SOLO company&quot;;
  ImageView business_logo;
  List&lt;Businesses&gt; businessesList;
  Button website, social, careers, contact;
  TextView business_name;
  TextView bdesc;
  VideoView videoView;
  
  
  
  private Context mContext;
  
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
      super.onCreate ( savedInstanceState );
      setContentView ( R.layout.company_solo_page );
      businessesList = new ArrayList&lt;&gt; ();
      business_name = findViewById ( R.id.bus_name );
      business_logo = findViewById ( R.id.profile_image );
      bdesc = findViewById ( R.id.bdesc );
      website = findViewById ( R.id.website );
      social = findViewById ( R.id.socialmedia );
      careers = findViewById ( R.id.careers );
      contact = findViewById ( R.id.contact );
      videoView = findViewById ( R.id.videorecycler );
      videoView.setVideoURI ( Uri.parse ( getIntent ().getStringExtra ( &quot;videos&quot; ) ) );
  
      business_name.setText ( getIntent ().getStringExtra ( &quot;bus_name&quot; ) );
      bdesc.setText ( getIntent ().getStringExtra ( &quot;bdesc&quot; ) );
      Glide.with ( this )
              .load ( getIntent ().getStringExtra ( &quot;Image_URL&quot; ) )
              .into ( business_logo );
      contact.setOnClickListener ( this::contact );
  </code></pre>
  <p>Any help would be appreciated</p>
  <p>----------------- <strong>UPDATE 22:34</strong> ---------------</p>
  <p>I am getting this error:
  Caused by: java.lang.ClassCastException: androidx.recyclerview.widget.RecyclerView cannot be cast to android.widget.VideoView</p>