Passing a activity context into a static method, memory leak potential? : <p>I've seen this particular technique for launching activities and it seems to me like a bad idea because of static contexts but I was hoping someone might have a legit reason behind this approach.</p>

<p>The activity you want to launch implements a static launch(Context context) method that sets up the intent, flags, etc and finally starts the activity.</p>

<pre><code>public static void launch(Context context){
   Intent i = new Intent(context, SomeOtherActivity.class);
   // flag stuff
   context.startActivity(i);
}
</code></pre>

<p>Then a DifferentActivity could go and launch SomeOtherActivity with one line.</p>

<pre><code>SomeOtherActivity.launch(DifferentActivity.this);
</code></pre>

<p>I like how it allows you to setup the flags in the activity away from the DifferentActivity that is launching it but it doesnt seem like a good enough reason to rationalize passing that activity's context into a static method.</p>

<p>Wouldn't this cause DifferentActivity to not be garbage collected because now that static method has a reference to it? This seems like a memory leak to me and probably not a good idea to do just to be able to keep the flags contained in the activity that is being created. </p>

<p>Is there something I'm missing here that makes this a good practice to do?</p>
