title: How to open URL after clicking at a particular item in RecyclerView?
body: <p>I am passing a List of objects to my adapter. The objects are of type <code>Uploads</code> class which contains just <code>Docname</code> and <code>Docurl</code>. After displaying the Docname on each of RecyclerView items, I want that when a user clicks at any item, browser should open with the URL corresponding to that item's URL.</p>
  <p>This is what I tried. Its not throwing any error and the app is running smoothly but when I click on any item, nothing happens.</p>
  <pre><code>public class EbookRepresentAdapter extends RecyclerView.Adapter&lt;EbookRepresentAdapter.EbookRepresentViewHolder&gt; {
  
      private Context mContext;
      private List&lt;Uploads&gt; mbooks;
      public String bookurl;
  
  
      public EbookRepresentAdapter(Context context, List&lt;Uploads&gt; books) {
          mContext = context;
          mbooks = books;
      }
  
      public class EbookRepresentViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
  
          public Context usecontext;
          public TextView mbookname;
  
  
          public EbookRepresentViewHolder(View itemView) {
              super(itemView);
  
              mbookname = itemView.findViewById(R.id.subjectname);
              usecontext=itemView.getContext();
  
          }
  
  
          @Override
          public void onClick(View v) {
  
              Intent intent=new Intent(Intent.ACTION_VIEW);
              intent.setData(Uri.parse(bookurl));
              mContext.startActivity(intent);
          }
      }
      
  
      @NonNull
      @Override
      public EbookRepresentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          View v= LayoutInflater.from(mContext).inflate(R.layout.subjectcard,parent,false);
          return new EbookRepresentViewHolder(v);
      }
  
      @Override
      public void onBindViewHolder(@NonNull EbookRepresentViewHolder holder, int position) {
  
          Uploads yearSubjectcurrent= mbooks.get(position);
          String subname=yearSubjectcurrent.getDocname();
          bookurl= yearSubjectcurrent.getDocurl();
          //Log.d(TAG,&quot;subname = &quot;+ subname);
          holder.mbookname.setText(subname);
  
      }
  
      @Override
      public int getItemCount() {
          return mbooks.size();
      }
  }
  </code></pre>
  <p>It would be great if anybody could help.</p>