title: How to add OnClickListener on ViewHolder 's TextView of RecyclerView.Adapter to execute AsyncTask
body: <p>Firstly I have seen many solutions here but  unable to understand it.
   I am confused about how i can execute AsyncTask inside OnTextClick().
  and want to know how we can implement this.<br>
      please do help.</p>
  
  <p>DownloadFormActivity.</p>
  
  <pre><code>public class DownloadFormActivity extends AppCompatActivity 
  {
      private String[] link_1;
      private Bitmap[] company_logo;
  
      private RecyclerView recyclerView;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_download_form);
  
          Bitmap bitmap_1 = BitmapFactory.decodeResource(getResources(), R.drawable.***********);
          Bitmap bitmap_2 = BitmapFactory.decodeResource(getResources(), R.drawable.***********);
          Bitmap bitmap_3 = BitmapFactory.decodeResource(getResources(), R.drawable.***********);
  
          link_1 = getResources().getStringArray(R.array.array_claimForm);
          company_logo = new Bitmap[]{bitmap_1, bitmap_2, bitmap_3};
  
          recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
          FormListAdapter adapter = new FormListAdapter(this, getdata());
  
          recyclerView.setLayoutManager(new LinearLayoutManager(this));
          recyclerView.setAdapter(adapter);
  
  
          //FormListAdapter fla =new FormListAdapter(context,getdata())
      }
  
      private List&lt;FormList&gt; getdata() {
          List&lt;FormList&gt; listdata = new ArrayList&lt;&gt;();
          for (int i = 0; i &lt; link_1.length; i++) {
              FormList formdata = new FormList();
              formdata.setCompany_logo(company_logo[i]);
              formdata.setLink_1(link_1[i]);
              listdata.add(formdata);
          }
          return listdata;
      }
  
      public class DownloadTask extends AsyncTask&lt;String,Integer,String&gt; {
  
          private ProgressDialog mProgressDialog;
  
          @Override
          protected void onPreExecute()
          {
              super.onPreExecute();
              mProgressDialog = new ProgressDialog(getApplicationContext());
              mProgressDialog.setMessage("Please Wait");
              mProgressDialog.setTitle("Downloading File");
              mProgressDialog.setIndeterminate(true);
              mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
              mProgressDialog.setCancelable(true);
              mProgressDialog.show();
          }
          @Override
          protected String doInBackground(String... urls) {
              InputStream input = null;
              OutputStream output = null;
              HttpURLConnection connection = null;
              int count = urls.length;
              if(count == 1) {
                  try {
                      URL url = new URL(urls[0]);
                      connection = (HttpURLConnection) url.openConnection();
                      connection.connect();
  
                      if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
                          return "Server returned HTTP " + connection.getResponseCode()
                                  + " " + connection.getResponseMessage();
                      }
  
                      int fileLength = connection.getContentLength();
  
                      input = connection.getInputStream();
                      output = new FileOutputStream("/sdcard/file_name.extension");
  
                      byte data[] = new byte[4096];
                      long total = 0;
                      int datacount;
                      while ((datacount = input.read(data)) != -1) {
  
                          if (isCancelled()) {
                              input.close();
                              return null;
                          }
                          total += datacount;
  
                          if (fileLength &gt; 0)
                              publishProgress((int) (total * 100 / fileLength));
                          output.write(data, 0, count);
                      }
                  } catch (Exception e) {
                      return e.toString();
                  } finally {
                      try {
                          if (output != null)
                              output.close();
                          if (input != null)
                              input.close();
                      } catch (IOException ignored) {
                      }
  
                      if (connection != null)
                          connection.disconnect();
                  }
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(String result) {
  
              mProgressDialog.dismiss();
              if (result != null)
                  Toast.makeText(context, "Download error: " + result, Toast.LENGTH_LONG).show();
              else
                  Toast.makeText(context, "File downloaded", Toast.LENGTH_SHORT).show();
          }
  
          @Override
          protected void onProgressUpdate(Integer... progress) {
              super.onProgressUpdate(progress);
  
              mProgressDialog.setIndeterminate(false);
              mProgressDialog.setMax(100);
              mProgressDialog.setProgress(progress[0]);
          }
      }
  }
  </code></pre>
  
  <p>FormListAdapter</p>
  
  <pre><code>ublic class FormListAdapter extends RecyclerView.Adapter&lt;FormListAdapter.MyViewHolder&gt; {
  
      List&lt;FormList&gt; data = Collections.emptyList();
      Context context;
      LayoutInflater inflater;
  
      public FormListAdapter(Context context,List&lt;FormList&gt; data)
      {
          this.context = context;
          this.data = data;
          this.inflater = LayoutInflater.from(context);
      }
  
      @Override
      public MyViewHolder onCreateViewHolder(final ViewGroup parent, int viewType)
      {
          View view = inflater.inflate(R.layout.download_form_list, parent,false);
          return new MyViewHolder(view, new MyViewHolder.ViewHolderClicks() {
              @Override
              public void onTextClick()
              {
  
                      //  how to call AsyncTask here
  
              }
          });
  
      }
  
      @Override
      public void onBindViewHolder(MyViewHolder holder, int position) {
          FormList current = data.get(position);
          holder.imageView.setImageBitmap(current.getCompany_logo());
          holder.textView_1.setText(current.getLink_1());
          holder.textView_2.setText(current.getLink_2());
          holder.textView_3.setText(current.getLink_3());
      }
  
      @Override
      public int getItemCount() {
          return data.size();
      }
  
  
      static class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
          private ImageView imageView;
          private TextView textView_1,textView_2,textView_3;
          private Context context;
  
          public ViewHolderClicks mClickListener;
  
          public MyViewHolder(View itemView, final ViewHolderClicks mListener) {
              super(itemView);
              this.mClickListener = mListener;
              imageView = (ImageView) itemView.findViewById(R.id.imageView_companyLogo);
              textView_1 = (TextView) itemView.findViewById(R.id.textView_link_1);
              textView_2 = (TextView) itemView.findViewById(R.id.textView_link_2);
              textView_3 = (TextView) itemView.findViewById(R.id.textView_link_3);
              textView_1.setOnClickListener(this);
          }
          @Override
          public void onClick(View v)
          {
              context = v.getContext();
              mClickListener.onTextClick();
          }
  
          public interface ViewHolderClicks
          {
              void onTextClick();
          }
      }
  }
  </code></pre>