title: setOnClickListener is not working in my cardapter inside a Fragment
body: <p>Hi everyone I have an issue while making my cardview clickable inside a fragment, it's basically a recyclerview which have a cardadapter if we get a result the image would be clickable
  here is my code, any help would be appreciated </p>
  
  <p><strong>XML:</strong></p>
  
  <pre><code> &lt;android.support.v7.widget.CardView
      xmlns:card_view="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="top"
  
      card_view:cardCornerRadius="4dp"&gt;
  
  &lt;RelativeLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"&gt;
      &lt;ImageView
          android:id="@+id/image_products_chosen"
          android:layout_width="200dp"
          android:layout_height="200dp"
          android:scaleType="centerCrop"
          android:clickable="true"
          android:focusable="true"/&gt;
      &lt;ProgressBar
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          style="@android:style/Widget.ProgressBar.Small"
          android:layout_marginTop="70dp"
          android:id="@+id/progress_product"/&gt;
  
   &lt;TextView
      android:id="@+id/nameproducts"
      android:layout_width="193dp"
      android:layout_height="wrap_content"
      android:layout_below="@+id/image_products"
      android:layout_marginLeft="5dp"
      android:layout_marginTop="2dp"
      android:layout_marginRight="20dp" /&gt;
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:visibility="invisible"
      android:id="@+id/imageurlproducts"/&gt;
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:visibility="invisible"
      android:id="@+id/priceitem"/&gt;
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:visibility="invisible"
      android:id="@+id/iditem"/&gt;
  &lt;/RelativeLayout&gt;
  &lt;/android.support.v7.widget.CardView&gt;
  </code></pre>
  
  <p><strong>Fragment code</strong></p>
  
  <pre><code>searchProductFromCategory fragment = new searchProductFromCategory();
      FragmentManager FM = getSupportFragmentManager();
      FragmentTransaction FT = FM.beginTransaction();
  
  
      FT.add(R.id.listproduct, fragment);
      FT.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
      FT.commit();
  </code></pre>
  
  <p><strong>cardadapter:</strong></p>
  
  <pre><code>public class CardProductFromCategory extends RecyclerView.Adapter &lt;CardProductFromCategory.ViewHolder&gt;{
  
      private ImageLoader imageLoader;
      private Context context;
      private Context context1;
      public ProgressBar progressbar1;
  
      //List of promoFeeds
      List&lt;Products&gt; PRODUCTS;
  
      public CardProductFromCategory(List&lt;Products&gt; product, Context context) {
          this.PRODUCTS = product;
          this.context = context;
      }
      @NonNull
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_products, parent, false);
          ViewHolder viewHolder = new CardProductFromCategory.ViewHolder(v);
  
          return viewHolder;
      }
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
  
          Products feed = PRODUCTS.get(position);
          Picasso.with(context).load(feed.getImageUrl()).into(holder.imageView);
  
          holder.textViewItemName.setText(feed.getItemName());
          holder.iditemtextview.setText(feed.getIDitem());
          holder.priceitemtextview.setText(feed.getPrice());
          holder.imageurl1.setText(feed.getImageUrl());
          progressbar1.setVisibility(View.GONE);
  
  
  
      }
  
      @Override
      public int getItemCount() {
          return  PRODUCTS.size();
      }
      class ViewHolder extends RecyclerView.ViewHolder  {
          public ImageView imageView;
          public TextView imageurl1, textViewItemName, iditemtextview, priceitemtextview;
  
  
          public ViewHolder(View itemView) {
              super(itemView);
  
  
  
              this.imageView = (ImageView) itemView.findViewById(R.id.image_products);
  
              textViewItemName = (TextView) itemView.findViewById(R.id.nameproducts);
              imageurl1 = (TextView) itemView.findViewById(R.id.imageurlproducts);
              iditemtextview = (TextView) itemView.findViewById(R.id.iditem);
              priceitemtextview = (TextView) itemView.findViewById(R.id.priceitem);
              progressbar1 = (ProgressBar) itemView.findViewById(R.id.progress_product);
              //imageurl1 = (TextView) itemView.findViewById(R.id.imageurl);
  
  
  
              imageView.setOnClickListener(new  android.widget.AdapterView.OnClickListener(){
                  @Override
                  public void onClick(View v) {
  
                     //code
  
  
  
                  }
              });
          }
      }
  
  }
  </code></pre>
  
  <p>While debugging looks like I can't access to the setOnClickListener
  Waiting for your answers guys :D</p>
  
  <pre><code> @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      if (getArguments() != null) {
          mParam1 = getArguments().getString(ARG_PARAM1);
          mParam2 = getArguments().getString(ARG_PARAM2);
  
  
      }
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                           Bundle savedInstanceState) {
  
      // Inflate the layout for this fragment
      View view = inflater.inflate(R.layout.fragment_search_product_from_category, container, false);
      try {
          connectedUser = new getUserID().execute(mParam2).get();
  
      } catch (InterruptedException e) {
          e.printStackTrace();
      } catch (ExecutionException e) {
          e.printStackTrace();
      }
  
      return view;
  }
  
  @Override
  public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
      recyclerView = (RecyclerView) view.findViewById(R.id.listcategory);
  
      getproduct(mParam1);
      CategoryFeed = new ArrayList&lt;&gt;();
  
  
  
  
      recyclerView.setHasFixedSize(true);
      GridLayoutManager glm = new GridLayoutManager(getContext(), 3);
      recyclerView.setAdapter(adapter1);
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(glm);
  
  
  }
  
  private String getproduct(final String product) {
  
      //progressbar1 = (ProgressBar) findViewById(R.id.progress_product);
  
      //Displaying Progressbar
      //progressbar1.setVisibility(View.VISIBLE);
      // setProgressBarIndeterminateVisibility(true);
  
      class getProducts extends AsyncTask&lt;String, Void, String&gt; {
          // ProgressDialog loading;
  
          @Override
          protected void onPostExecute(String s) {
              //  progressbar1.setVisibility(View.GONE);
              super.onPostExecute(s);
              try {
                  JSONObject JSONOBJ = new JSONObject(s);
                  CategoryFeedJson = JSONOBJ.getJSONArray("Products");
                  for (int i = 0; i &lt; CategoryFeedJson.length(); i++) {
                      Products feed = new Products();
                      JSONObject json = CategoryFeedJson.getJSONObject(i);
                      feed.setItemtName(json.getString("ItemName"));
                      feed.setImageUrl(json.getString("image"));
                      feed.setPrice(json.getString("price"));
                      feed.setIDitem(json.getString("IDItems"));
                      CategoryFeed.add(feed);
                  }
                  context = getActivity();
                  adapter1 = new CardProductFromCategory(CategoryFeed, context);
                  recyclerView.setAdapter(adapter1);
  
              } catch (JSONException e) {
                  e.printStackTrace();
              }
              // loading.dismiss();
          }
  
          @Override
          protected String doInBackground(String... params) {
              HashMap&lt;String, String&gt; data = new HashMap&lt;&gt;();
              data.put("products", mParam1);
              RegisterUserClass ruc = new RegisterUserClass();
              String result;
              result = ruc.sendPostRequest(Config.DATA_PRODUCTS, data);
  
              return result;
          }
      }
      getProducts uns = new getProducts();
      uns.execute(product);
  
      return product;
  }
  
  
  
  public class CardProductFromCategory extends RecyclerView.Adapter &lt;CardProductFromCategory.ViewHolder&gt;{
  
      private ImageLoader imageLoader;
      private Context mcontext;
      public ProgressBar progressbar1;
  
      //List of promoFeeds
      List&lt;Products&gt; PRODUCTS;
  
      public CardProductFromCategory(List&lt;Products&gt; product, Context context) {
          this.PRODUCTS = product;
          this.mcontext = context;
      }
      @NonNull
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_products, parent, false);
          ViewHolder viewHolder = new CardProductFromCategory.ViewHolder(v);
  
          return viewHolder;
      }
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
  
          Products feed = PRODUCTS.get(position);
          Picasso.with(context).load(feed.getImageUrl()).into(holder.imageView);
  
          holder.textViewItemName.setText(feed.getItemName());
          holder.iditemtextview.setText(feed.getIDitem());
          holder.priceitemtextview.setText(feed.getPrice());
          holder.imageurl1.setText(feed.getImageUrl());
          progressbar1.setVisibility(View.GONE);
  
  
  
      }
  
      @Override
      public int getItemCount() {
          return  PRODUCTS.size();
      }
  
      class ViewHolder extends RecyclerView.ViewHolder {
          public ImageView imageView;
          public TextView imageurl1, textViewItemName, iditemtextview, priceitemtextview;
          public LinearLayout rl;
  
  
          public ViewHolder(View itemView) {
              super(itemView);
              rl = (LinearLayout)itemView.findViewById(R.id.rl_product);
  
              this.imageView = (ImageView) itemView.findViewById(R.id.image_products);
              textViewItemName = (TextView) itemView.findViewById(R.id.nameproducts);
              imageurl1 = (TextView) itemView.findViewById(R.id.imageurlproducts);
              iditemtextview = (TextView) itemView.findViewById(R.id.iditem);
              priceitemtextview = (TextView) itemView.findViewById(R.id.priceitem);
              progressbar1 = (ProgressBar) itemView.findViewById(R.id.progress_product);
              //imageurl1 = (TextView) itemView.findViewById(R.id.imageurl);
              //imageView.setOnClickListener(this);
              imageView.setOnClickListener(new  View.OnClickListener(){
                  @Override
                  public void onClick(View v) {
                      String a,b,c,d;
                      c =imageurl1.getText().toString();
                      b = textViewItemName.getText().toString();
                      d =priceitemtextview.getText().toString();
                      a = iditemtextview.getText().toString();
  
                      uploadProduct (a,b,c,d);
                  }
              });
          }
      }
  
  }
  </code></pre>