How do I call activity method from Adapter class
<p>I have three Class</p>

<p>mainActivity.java</p>

<pre><code>public class mainactivity extends AppCompatActivity{

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.abc);

} 


public void firstDialog()
{

  //Do something
  //call next method

  secondDialog()

}

public void secondDialog()
{
  //Do something
}

}
</code></pre>

<p>Next is another class which is calling the adaptor class
secondclass.java</p>

<pre><code>public class secondclass extends AppCompatActivity {


@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.xyz);

        //calling and set adaptor
        adapter=new Myadaptopr(this,result);
        recyclerlist.setAdapter(adapter);

}
</code></pre>

<p>//Now the Adaptor class</p>

<pre><code>    public class Myadaptopr extends RecyclerView.Adapter&lt;Myadaptopr.ViewHolder&gt; {


     @Override
        public void onBindViewHolder(final MedicineAdaptor.ViewHolder holder, int position) {
       //In this function I need to call firstDialog() Method How Do I proceed.

    }

}
</code></pre>

<p><strong>My Question is:</strong></p>

<p>How do I call the methods of mainactivity.java class file. 
I have tried solution:
but didn't work because mainactivity class don't call and set the adapter. 
((mainactivity)context).firstDialog();</p>