title: Should I have my global variables in the Application class or an Activity that all activities extend
body: <p>Right now all my tools that I need (a DatabaseHelper singleton, an ImageLoader singleton, a PhotoHandler, a custom Toast Maker) are initialized in the onCreate of an Activity that all my activities extend from, but I just now realized that every time a new activity is started, these all get instatiated anew.</p>
  
  <p>So is this a problem?</p>
  
  <p>Should I change to creating a Class that extends Application and have these variables there?
  If so, which method of that Application class should I instantiate those?</p>
  
  <p>To make the picture complete I also have a public static finals class that holds all kinds of constants like error messages and app preferences</p>
  
  <p>And I have a InitialDataLoader class that is executed right after the user logs in that gets everything the user needs from the server and stores it locally.</p>
  
  <p>So which should be the more suitable place for me to instantiate the forementioned tools?</p>
  
  <p>Here is a part of the Activity that all my activities extend from:</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      dbTools = DBTools.getInstance(this);
  
      // Create global configuration and initialize ImageLoader with this configuration
      // https://github.com/nostra13/Android-Universal-Image-Loader
      ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();
      imageLoader = ImageLoader.getInstance();
      imageLoader.init(imageLoaderConfiguration);
  
      // Set global bitmap preferences
      bitmapOptions = new BitmapFactory.Options();
      bitmapOptions.inDither = false;
      bitmapOptions.inPurgeable = true;
      bitmapOptions.inInputShareable = true;
      bitmapOptions.inTempStorage = new byte[16 * 1024];
  
      // Get an instance of the current user
      instanceOfTheCurrentUser = Transporter.instance().instanceOfTheCurrentUser;
  </code></pre>