Why cant I call a method from adapter?
<p>I have an adapter class and an activity, I want to call the activity method from adapter</p>

<blockquote>
  <p>Adapter</p>
</blockquote>

<pre><code>holder.fab_plus.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                        ((MainActivity)context).getTotalPrice();

                }
            });
</code></pre>

<blockquote>
  <p>MainActivity</p>
</blockquote>

<pre><code>@Override
public void getTotalPrice() {
    Toast.makeText(MainActivity.this, "Your Message Has Been Sent", Toast.LENGTH_SHORT).show();
}
</code></pre>

<p>I want to call getTotalPrice method form adapter</p>