title: Use startActivityForResult from non-activity
body: <p>I have MainActivity  which is an Activity and other class(which is a simple java class), we'll call it &quot;SimpleClass&quot;.</p>
  <p>Now I want to run from that class the command <code>startActivityForResult</code>.</p>
  <p>I though that I could pass that class (SimpleClass), using only MainActivity's context, but the problem is that we can't run <code>context.startActivityForResult(...);</code>.</p>
  <p>So, the only way making SimpleClass to use <code>startActivityForResult</code>, is to pass the reference of MainActivity as an Activity variable to the SimpleClass.</p>
  <p>Something like that:</p>
  <p>Inside the MainActivity class I created the instance of SimpleClass like this way:</p>
  <pre><code>SimpleClass simpleClass = new SimpleClass(MainActivity.this);
  </code></pre>
  <hr />
  <p>Now, this is how SimpleClass looks like:</p>
  <pre><code>public Class SimpleClass {
  
  Activity myMainActivity;
  
     public SimpleClass(Activity mainActivity) {
         super();
         this.myMainActivity=mainActivity;    
     }
  ....
  
  
      public void someMethod(...) {
          myMainActivity.startActivityForResult(...);
      }
  
  }
  </code></pre>
  <p>Now it's working, but isn't there a proper way of doing this? I am afraid I could have some memory leaks in the future.</p>