title: The method getApplication() is undefined for the type error
body: <p>I have a class which extends activity and I call another class which extends view. Below you can see how I call:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) 
  {
          super.onCreate(savedInstanceState);
          GifView gifView = (GifView)findViewById(R.id.gifview);
  }
  </code></pre>
  
  <p>In GifView Class, which extends View, I am trying to reach an instance of global class but I am having <code>The method getApplication() is undefined for the type GifView</code> error. Here you can see how I call it.</p>
  
  <pre><code>AppDelegate appDelegate = ((AppDelegate)getApplication());
  </code></pre>
  
  <p>I am wondering how can I reach <code>AppDelegate</code> class without getApplication error. </p>
  
  <p>And here how I declared AppDelegate class:</p>
  
  <pre><code>public class AppDelegate extends Application {
  
      public AppDelegate() {
          instance = this;
      }
  ..
  </code></pre>