title: How to add OnclickListener for button inside a cardView populated using a recyclerView?
body: <p>As one can see from the code, I want to put the Intent part for the next activity on ButtonClick. Right now, its inside setItemClickListener due to which on clicking anywhere on the whole card view its moving to next activity. I want to restrict it wrt. applybtn (as mentioned in my code).
  Kindly, anyone guide me based on my code. I don't know the actual syntax.</p>
  
  <pre><code>package com.example.shubhojit.jobs;
  
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.View;
  import android.widget.Button;
  
  import com.example.shubhojit.jobs.Interface.ItemClickListener;
  import com.example.shubhojit.jobs.Model.Jobs;
  import com.example.shubhojit.jobs.ViewHolder.JobsViewHolder;
  import com.firebase.ui.database.FirebaseRecyclerAdapter;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  
  import me.anwarshahriar.calligrapher.Calligrapher;
  
  public class ExactJobList_recycler extends AppCompatActivity {
  
      FirebaseDatabase database;
      DatabaseReference joblist;
      RecyclerView recycler_joblist;
      RecyclerView.LayoutManager layoutManager;
      FirebaseRecyclerAdapter&lt;Jobs,JobsViewHolder&gt; adapter;
      Button applybtn;
  
      String categoryId="";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_exact_job_list_recycler);
  
          Calligrapher calligrapher = new Calligrapher(this);
          calligrapher.setFont(this, "Fonts/Futura Book font.ttf", true);
  
          database = FirebaseDatabase.getInstance();
          joblist = database.getReference("Job_Details");
  
          recycler_joblist = (RecyclerView)findViewById(R.id.recycler_jobList);
          applybtn = (Button)findViewById(R.id.applybutton) ;
          recycler_joblist.setHasFixedSize(true);
          layoutManager = new LinearLayoutManager(this);
          recycler_joblist.setLayoutManager(layoutManager);
  
          if(getIntent() != null)
              categoryId = getIntent().getStringExtra("CategoryId");
          if (!categoryId.isEmpty() &amp;&amp; categoryId !=null)
          {
              loadListJobs(categoryId);
          }
      }
  
      private void loadListJobs(String categoryId) {
  
          adapter = new FirebaseRecyclerAdapter&lt;Jobs,JobsViewHolder&gt;(Jobs.class,R.layout.exactjoblist__item,JobsViewHolder.class,
                  joblist.orderByChild("MenuId").equalTo(categoryId)
          ) {
  
              @Override
              protected void populateViewHolder(JobsViewHolder viewHolder, Jobs model, int position) {
                  viewHolder.jobs_Name.setText(model.getJobName());
                  viewHolder.jobs_Description.setText(model.getJobDescription());
                  viewHolder.jobs_Openingdate.setText(model.getJobOpeningDate());
                  viewHolder.jobs_Post.setText(model.getJobPost());
                  viewHolder.jobs_NoofPost.setText(model.getJobNoofpost());
                  viewHolder.jobs_Salary.setText(model.getJobSalary());
                  viewHolder.jobs_Qualification.setText(model.getJobQualification());
                  viewHolder.jobs_Agelimit.setText(model.getJobAgelimit());
                  viewHolder.jobs_Lastdate.setText(model.getJoblastdate());
                  final Jobs local = model;
                  viewHolder.setItemClickListener(new ItemClickListener() {
                      @Override
                      public void onClick(View view, int position, boolean isLongClick) {
  
                          Intent JobDetail = new Intent(ExactJobList_recycler.this,Job_Details.class);
                          JobDetail.putExtra("JobId",adapter.getRef(position).getKey());
                          startActivity(JobDetail);
                      }
                  });
  
              }
          };
          recycler_joblist.setAdapter(adapter);
      }
  }
  </code></pre>