title: Android: How to send interface from one activity to another
body: <p>I have an interface like this: </p>
  
  <pre><code>public interface MyInterface {
      public void aMethod();
  }
  </code></pre>
  
  <p>My custom Object:</p>
  
  <pre><code>public class MyObject {
  
      private Context context;
      private MyInterface inter;
  
      public MyObject(Context context) {
          this.context = context;
          this.inter = (MyInterface) this.context;
          inter.aMethod();
      }
  }
  </code></pre>
  
  <p>MainActivity:</p>
  
  <pre><code>public class MainActivity extends Activity implements MyInterface {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          MyObject my = new MyObject(this);
  
      }
  
      @Override
      public void aMethod() {
          Toast.makeText(this, "done", Toast.LENGTH_SHORT).show();
      }
  }  
  </code></pre>
  
  <p>Here, inside MyObject constructor i can get the interface from the context and then communicate with the Activity.  </p>
  
  <p><strong>But how can i send interface from one activity to another ?<br>
  I need to call a method inside Activity1 from Activity2<br>
  Is there a way like this ?</strong>  </p>
  
  <p><strong>Note:</strong> i don't want to use fragment.</p>