title: Android: Why Can't I Override setFrame From View?
body: <p>Simply trying to extend View and do some custom work, but Eclipse will complain when I attempt to override the setFrame method. Claiming there isn't a method in the parent class to override: </p>
  
  <blockquote>
    <p>The method setFrame(int, int, int, int) of type Test must override or implement a supertype method</p>
  </blockquote>
  
  <p>Here is the signature of the method from android SDK source.</p>
  
  <pre><code>protected boolean setFrame(int left, int top, int right, int bottom)</code></pre>
  
  <p>As you can see it's not private or package level, or even specified as final... just protected. Which should mean I am totally able to override it in a subclass. Right? Below is the bare minimum of what I'm trying to do in Eclipse. Perhaps it is just an Eclipse error, but I'm not too familiar with using Ant to check against that.</p>
  
  <p><b>Edit: To those answering that setFrame is not defined in the View class, I can assure you it is. How else do you think I got the method signature? It is even called during layout(). Or am I seriously just crazy?</b></p>
  
  <p>git HEAD: <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/view/View.java;hb=HEAD" rel="nofollow">View.java</a><br>
  Cupcake (1.5r4): <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/view/View.java;h=0a84aa01d04eaf34c896987fb8bf55fe57438ff5;hb=46e23fe762d2143d60589ab6d39c4b47c2c754d1" rel="nofollow">View.java</a></p>
  
  <p>You can even see the method <b>being overriden</b> in the <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/widget/ImageView.java;hb=HEAD" rel="nofollow">ImageView</a> and <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/widget/TextView.java;hb=HEAD" rel="nofollow">TextView</a> classes...this is why I am seriously confused as to why I cannot override it myself from View directly...</p>
  
  <pre><code>public class Test extends View {
      public Test(Context context) {
          super(context);
      }
  
      public Test(Context context, AttributeSet attrs) {
          super(context, attrs);
      }
  
      public Test(Context context, AttributeSet attrs, int defStyle) {
          super(context, attrs, defStyle);
      }
  
      @Override
      protected boolean setFrame(int left, int top, int right, int bottom) {
          return super.setFrame(left, top, right, bottom);
      }
  }</code></pre>