title: Illegal Argument Exception at Picasso in Android Recycler view
body: <p>I need to get an Image into the Image View using Picasso library Below is my code</p>
  
  <pre><code> Picasso.get().load(mFilteredList.get(position).getViewProductImage()).into(holder.imageView);
  </code></pre>
  
  <p>But I'm getting the error like</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: Target must not be null. at
    com.squareup.picasso.RequestCreator.into(RequestCreator.java:682) at
    com.squareup.picasso.RequestCreator.into(RequestCreator.java:665)</p>
  </blockquote>
  
  <p>Can anyone tell me how to get the images into the imagesView. Below is my adapter class</p>
  
  <pre><code>public class ViewAllAdapter extends RecyclerView.Adapter&lt;ViewAllAdapter.ViewAllViewHolder&gt; {
  
      List&lt;String&gt; listOfIds=new ArrayList&lt;&gt;();
      ArrayList&lt;ViewAllObject&gt; data;
      Context myContext;
      private ImageView imageView;
      private ArrayList&lt;ViewAllObject&gt; mFilteredList;
      public ViewAllAdapter(List&lt;ViewAllObject&gt; data){
          this.data= (ArrayList&lt;ViewAllObject&gt;) data;
          this.mFilteredList = (ArrayList&lt;ViewAllObject&gt;) data;
      }
  
      @NonNull
      @Override
      public ViewAllViewHolder onCreateViewHolder(@NonNull final ViewGroup parent, int viewType) {
          myContext = parent.getContext();
          View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.view_all_items,parent,false);
          final TextView textView=(TextView)view.findViewById(R.id.view_all_product_vendor_name);
          final TextView textView1=(TextView)view.findViewById(R.id.view_all_product_title);
          return new ViewAllViewHolder(view);
      }
  
      @Override
      public void onBindViewHolder(@NonNull ViewAllViewHolder holder, int position) {
          final ViewAllObject viewAllObject=data.get(position);
          holder.itemView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent i=new Intent(myContext,DescriptionActivity.class);
                  i.putExtra("productname",viewAllObject.getVendorName());
                  i.putExtra("title",viewAllObject.getProductsTitle());
                  i.putExtra("description",viewAllObject.getProductDescription());
                  i.putStringArrayListExtra("imagesList", (ArrayList&lt;String&gt;) viewAllObject.getImagesList());
                  i.putExtra("productSet",viewAllObject.getProductSet());
                  i.putExtra("productQuantity",viewAllObject.getAvalibileQuantity());
                  i.putExtra("productId",viewAllObject.getProductId());
                  i.putExtra("productImage",viewAllObject.getViewProductImage());
                  i.putExtra("productType",viewAllObject.getViewAllProductType());
                  i.putExtra("productPrice",viewAllObject.getViewAllPrice());
                  myContext.startActivity(i);
              }
          });
          LinearLayout addToCartIcon=(LinearLayout) holder.itemView.findViewById(R.id.view_all_items_cart_icon);
  
          addToCartIcon.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  List&lt;Long&gt; lisId=new ArrayList&lt;&gt;();
                  List&lt;CartItemsTable&gt; cartItems=Almirah.cartDB.MyDao().getCartItems();
                  for (CartItemsTable cartItemsTable1:cartItems) {
  
                  long productId = cartItemsTable1.getProductId();
                  lisId.add(productId);
  
              }
              boolean newItem = true;
              for (int i=0;i&lt;lisId.size();i++){
                  if (viewAllObject.getProductId() == lisId.get(i)){
                      newItem = false;
                      AlertDialog.Builder builder;
                      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
                          builder = new AlertDialog.Builder(myContext, android.R.style.Theme_Material_Dialog_Alert);
                      } else {
                          builder = new AlertDialog.Builder(myContext);
                      }
                      builder.setMessage("Item Already In Cart")
                              .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                                  public void onClick(DialogInterface dialog, int which) {
                                  }
                              })
                              .setIcon(android.R.drawable.ic_dialog_alert)
                              .show();
                  }
              }
              if (newItem) {
                  String date = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).format(new Date());
                  Gson gson = new Gson();
                  Type type = new TypeToken&lt;List&lt;String&gt;&gt;() {}.getType();
                  String imagesList = gson.toJson(viewAllObject.getImagesList(), type);
  
                  CartItemsTable cartItemsTable = new CartItemsTable();
                  cartItemsTable.setVendorName(viewAllObject.getVendorName());
                  cartItemsTable.setProductsTitle(viewAllObject.getProductsTitle());
                  cartItemsTable.setViewAllPrice(viewAllObject.getViewAllPrice());
                  cartItemsTable.setProductSet(viewAllObject.getProductSet());
                  cartItemsTable.setAvalibileQuantity(viewAllObject.getAvalibileQuantity());
                  cartItemsTable.setProductId(viewAllObject.getProductId());
                  cartItemsTable.setViewAllProductType(viewAllObject.getViewAllProductType());
                  cartItemsTable.setViewProductImage(viewAllObject.getViewProductImage());
                  cartItemsTable.setQuantity(1);
                  cartItemsTable.setDate(date);
                  cartItemsTable.setProductDescription(viewAllObject.getProductDescription());
                   cartItemsTable.setImagesList(imagesList);
                  ALmirah.cartDB.MyDao().addCartItems(cartItemsTable);
  
                  int cartCount=Integer.parseInt(ActivityForViewAll.countTextview.getText().toString());
                  ActivityForViewAll.countTextview.setText((cartCount+1)+"");
  
                  ActivityForViewAll.countTextview.setVisibility(View.VISIBLE);
  
                  Toast  toast=Toast.makeText(myContext, viewAllObject.getProductsTitle() + " Added to cart", Toast.LENGTH_SHORT);
                  View view1 = toast.getView();
                  view1.getBackground().setColorFilter(Color.parseColor("#FFF7D3A5"), PorterDuff.Mode.SRC_IN);
                  toast.show();
  
              }
              }
          });
      // holder.bindItems(viewAllObject);
          holder.viewAllProductVendorName.setText(mFilteredList.get(position).getVendorName());
         holder.viewAllProductTitle.setText(mFilteredList.get(position).getProductsTitle());
          holder.viewAllProductType.setText(mFilteredList.get(position).getViewAllProductType());
          holder.viewAllProductPrice.setText(mFilteredList.get(position).getViewAllPrice()+"SR");
       Picasso.get().load(mFilteredList.get(position).getViewProductImage()).into(holder.imageView); Picasso.get().load(viewAllObject.getViewProductImage()).into(imageView);
  
      }
  
      @Override
      public int getItemCount() {
          return mFilteredList.size();
      }
  
      public Filter getFilter() {
          return new Filter() {
              @Override
              protected FilterResults performFiltering(CharSequence charSequence) {
  
                  String charString = charSequence.toString();
  
                  if (charString.isEmpty()) {
  
                      mFilteredList = data;
                  } else {
  
                      ArrayList&lt;ViewAllObject&gt; filteredList = new ArrayList&lt;&gt;();
  
                      for (ViewAllObject viewAllObject : data) {
  
                          if (viewAllObject.getProductsTitle().toLowerCase().contains(charString) || viewAllObject.getViewAllProductType().toLowerCase().contains(charString) || viewAllObject.getViewAllPrice().toLowerCase().contains(charString)) {
  
                              filteredList.add(viewAllObject);
                          }
                      }
  
                      mFilteredList = filteredList;
                  }
  
                  FilterResults filterResults = new FilterResults();
                  filterResults.values = mFilteredList;
                  return filterResults;
              }
  
              @Override
              protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
                  mFilteredList = (ArrayList&lt;ViewAllObject&gt;) filterResults.values;
                  notifyDataSetChanged();
              }
          };
      }
  
      public class ViewAllViewHolder extends RecyclerView.ViewHolder{ 
          private TextView viewAllProductVendorName,viewAllProductTitle,viewAllProductType,viewAllProductPrice; 
          private ImageView imageView;
  
          public ViewAllViewHolder(@NonNull View itemView) {
              super(itemView);
               viewAllProductVendorName=(TextView)itemView.findViewById(R.id.view_all_product_vendor_name);
  
  
              ImageView imageView=(ImageView)itemView.findViewById(R.id.card_view_all_img);
  
             viewAllProductTitle=(TextView)itemView.findViewById(R.id.view_all_product_title);
  
             viewAllProductType=(TextView)itemView.findViewById(R.id.view_all_product_type);
  
             viewAllProductPrice=(TextView)itemView.findViewById(R.id.view_all_product_price);
  
          }
      } }
  </code></pre>