title: Call interface method implemented in an activity from a java class
body: <p>I want to call an interface method implemented in activity A from a java class where web apis are written. </p>
  
  <p>Flow is like moving from activity A to activity B and from activity B an api written in a separate java class is called, now on successful result of api, I want to invoke the interface method implemented in Activity A.</p>
  
  <p>A -> B -> Java class -> interface() in A</p>
  
  <p>I am facing problem in getting reference of activity A in java class for calling interface method. I have tried follwing code but nothing worked. Thanks for your time and help</p>
  
  <pre><code>Interface objInterface =  (Interface) context;
  objInterface.funInterface();
  
  Interface objInterface =  (Interface) context.getApplicationContext();
  objInterface.funInterface();
  
  Interface objInterface =  (Interface) new Activity_A;
  objInterface.funInterface();
  </code></pre>