title: How can I show Interstitial ad from Non Activity Class?
body: <p>I have a non activity class named custom adapter which shows images on main activity which loads images from the internet and sets wallpapers on click
  I want to show interstitial ad from Non Activity class,(CustomAdapter) when image view is clicked 
  Tried many stuff but doesn't work out , plz help me out</p>
  
  <p><strong>Custom Adapter.java</strong></p>
  
  <pre><code>    class CustomViewHolder extends  RecyclerView.ViewHolder {
  
      RibbonLayout ribbonLayout;
      ImageView imageView;
  
      public CustomViewHolder(View itemView) {
          super(itemView);
  
          ribbonLayout = (RibbonLayout)itemView.findViewById(R.id.ribbonLayout);
          imageView = (ImageView)itemView.findViewById(R.id.imageView);
      }
  
      }
  
      public class CustomAdapter extends  RecyclerView.Adapter&lt;CustomViewHolder&gt; {
  
      Context context;
  
      List&lt;Item&gt; itemList;
  
      public CustomAdapter(Context context, List&lt;Item&gt; itemList) {
          this.context = context;
          this.itemList = itemList;
      }
  
      @Override
      public CustomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(context).inflate(R.layout.item_layout, parent, false);
          return new CustomViewHolder(itemView);
  
      }
  
      @Override
      public void onBindViewHolder(CustomViewHolder holder, int position) {
          Item item = itemList.get(position);
          if (item.type == 0) { //new
              holder.ribbonLayout.setShowBottom(false);
              holder.ribbonLayout.setShowBottom(false);
  
  
              holder.ribbonLayout.setHeaderRibbonColor(Color.parseColor("#2B323A"));
              holder.ribbonLayout.setHeaderTextColor(Color.parseColor("#FFFFFF"));
  
              holder.ribbonLayout.setHeaderText((item.headerText));
              Picasso.with(context).load(item.imageURL)
                      .into(holder.imageView);
              holder.imageView.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      try {
                          Bitmap bitmap = ((BitmapDrawable) ((ImageView) view).getDrawable()).getBitmap();
                          WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);
                          wallpaperManager.setBitmap(bitmap);
  
                          Toast.makeText(context, " \\ (•◡•) /Yay! Wallpaper Set \\ (•◡•) / ", Toast.LENGTH_LONG).show();
                      } catch (Exception e) {
                          e.printStackTrace();
                      }
                  }
              });
          }
      }
  
      @Override
      public int getItemCount() {
          return itemList.size();
      }
  }
  </code></pre>