title: In Android how do you get a reference to a global variable that is a subclass of another global variable?
body: <p>I created a global variable called GlobalVariables in my app:</p>
  <pre><code>public class GlobalVariables extends Notifications {
       private boolean purchased = false;
  
       public boolean getPurchaseState() {
           return this.purchased;
       }
  
       public void setPurchaseState(boolean result) {
           purchased = result;
       }
  
  }
  </code></pre>
  <p>As you may have noticed it extends a class called Notifications instead of extending Application. This is because I already had a class called Notifications which itself extends Application, and I read that it's not possible for two classes to extend Application since only one class can be added in the <code>&lt;application</code> tag in Manifest, and in my case that class is Notifications. I read that the solution was simply to have one class subclass other, so I had GlobalVariables subclassing Notifications.</p>
  <p>So I then wrote this in my activity</p>
  <pre><code>GlobalVariables globalVariables = (GlobalVariables) getApplication(); 
  </code></pre>
  <p>which causes a crash that says <code>getApplication()</code> cannot be cast to <code>GlobalVariables</code>.
  How do I get globalVariables?</p>