title: how to use Interface in adapter class and activity together
body: <p>How can I update item count in action bar  when the move button in one item (in the <code>RecyclerView</code>) is pressed?</p>
  
  <p>My <code>WishlistActivity</code> class</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_wishlist);
  
          toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          dbHelper = new DatabaseHelper(this);
  
          ActionBar actionBar = getSupportActionBar();
          actionBar.setTitle("Wishlist");
          toolbar.setTitleTextColor(Color.WHITE);
          actionBar.setDisplayHomeAsUpEnabled(true);
          actionBar.setHomeButtonEnabled(true);
  
          wishlistRecycler = (RecyclerView) findViewById(R.id.wishlist_recycler);
          GridLayoutManager layoutManager = new GridLayoutManager(this,2,GridLayoutManager.VERTICAL,false);
          wishlistRecycler.setLayoutManager(layoutManager);
          wishlistRecycler.addItemDecoration(new Space(2,20,true,0));
          adapter = new wishlistAdapter(itemsWish,getApplicationContext(),cartCounter);
          wishlistRecycler.setAdapter(adapter);
  
          wish_count = dbHelper.getWishCount();
          emptyLayout = (RelativeLayout) findViewById(R.id.emptyWishLayout);
          wishLayout = (RelativeLayout) findViewById(R.id.wishLayout);
          contShopp = (Button) findViewById(R.id.continueShope);
  
          cartCounter = new MoveWishlistToCart() {
              @Override
              public void setCounter(int count) {
                  Toast.makeText(WishlistActivity.this, "Called", Toast.LENGTH_SHORT).show();
                  Log.d("Log","cartCounter: "+count);
              }
          };
  </code></pre>
  
  <p>My wishlistAdapter class</p>
  
  <pre><code>public wishlistAdapter(List&lt;WishlistItems&gt; wishItems, Context context, MoveWishlistToCart cartCounter) {
          this.wishItems = wishItems;
          this.context = context;
          this.cartCounter = cartCounter;
      }
  
      @NonNull
      @Override
      public myViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
  
          View rootView;
          rootView = LayoutInflater.from(context).inflate(R.layout.wish_list,null,false);
  
          return new myViewHolder(rootView);
      }
  
      @Override
      public void onBindViewHolder(@NonNull myViewHolder holder, final int position) {
  
          WishlistItems wishlistItems = wishItems.get(position);
          dbHelper = new DatabaseHelper(context);
  
          wish_sku = wishlistItems.getWishItemSku();
          price = wishlistItems.getWishItemPrice();
          sCount = dbHelper.getCountTotal();
  
          holder.textBrandName.setText(wishlistItems.getWishItemBrandName());
          holder.textPrice.setText("₹"+wishlistItems.getWishItemPrice());
  
          String imageUrl = wishItems.get(position).getWishImage();
          Picasso.with(context).load("http://www.app.ssmkanmanam.com/public/images/"+imageUrl).into(holder.mImageview);
  
          holder.mRemove.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  //Toast.makeText(activity, "Hii", Toast.LENGTH_SHORT).show();
                  removeFromWishlistDb(position);
                  wishItems.remove(position);
                  notifyDataSetChanged();
              }
          });
  
          holder.textMoveToBag.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  removeFromWishlistDb(position);
                  wishItems.remove(position);
                  notifyDataSetChanged();
                  moveToCartDb();
  
                  cartCounter.setCounter(1);
  
  
              }
          });
      }
  </code></pre>
  
  <p>My interface class</p>
  
  <pre><code>public interface MoveWishlistToCart {
      public void setCounter(int count);
  }
  </code></pre>