Android Application Class Globals instance or static
<p>I am using the android.app.Application class (a subclass) to store some "global" information.  An example is the user location the last time we grabbed it from the GPS/wifi.  My question is whether I should be storing these "globals" as static variables or instance variables.  Not sure which scenario is better or more correct.</p>

<p>Scenario A: using static variables --</p>

<pre><code>public class MyApplication extends android.app.Application {

    private static Location myLocation;
    public static Location getLocation() {
      return myLocation;
    }
    public static void setLocation(Location loc) {
      myLocation = loc;
    }
}
</code></pre>

<p>Scenario A: usage --</p>

<pre><code>loc = MyApplication.getLocation();
MyApplication.setLocation(loc);
</code></pre>

<p>Scenario B: using instance variables --</p>

<pre><code>public class MyApplication extends Application {

    private Location myLocation;
    public Location getLocation() {
      return this.myLocation;
    }
    public void setLocation(Location loc) {
      this.myLocation = loc;
    }
}
</code></pre>

<p>Scenario B: usage --</p>

<pre><code>loc = getApplication().getLocation();
getApplication().setLocation(loc);
</code></pre>

<p>Thank you.</p>
