Call startActivityForResult from static method
<p>I have a buttonlistener, and when the user clicks the button I want to start a camera intent. 
At the moment I have this: </p>

<pre><code>public class ButtonListener implements View.OnClickListener 
{
private ArrayList&lt;String&gt; connectedItems;
private String identifier = null;
private Context context;
private EnteredValues enteredValues;

public ButtonListener(Context c, String identifier, ArrayList&lt;String&gt; connectedItems) {
    this.connectedItems = connectedItems;
    this.identifier = identifier;
    this.context = c;
}

public void onClick(View v) {
    if (identifier.equals(ButtonItem.takePhoto)) {
        MainActivity.takePhoto();
    }

}
</code></pre>

<p>Now I want to call a method in my mainActivity and there I want to start startActivityForResult, but I get an error that I can't call startActivityForResult from a static method. </p>

<pre><code>public class mainActivity extends Activity{
...
   public static void takePhoto(){
       startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE));
          break;

       //Here I get the error..
   }
</code></pre>

<p>}</p>

<p>What is the best practice to fix this sort of problem?  pass a mainActivity object to my buttonListener or are there other options? </p>

<p>Many thx :) </p>
