Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3806644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:52:00+00:00 2026-05-19T14:52:00+00:00

Simply trying to extend View and do some custom work, but Eclipse will complain

  • 0

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:

The method setFrame(int, int, int, int) of type Test must override or implement a supertype method

Here is the signature of the method from android SDK source.

protected boolean setFrame(int left, int top, int right, int bottom)

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.

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?

git HEAD: View.java
Cupcake (1.5r4): View.java

You can even see the method being overriden in the ImageView and TextView classes…this is why I am seriously confused as to why I cannot override it myself from View directly…

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);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:52:01+00:00Added an answer on May 19, 2026 at 2:52 pm

    According to the documentation, setFrame is not defined in the View class (not strictly true – see edit). Surprising, each subclass, TextView and ImageView, define it themselves. You’ll have to have to extend the specific subclass for each widget you want to override this behavior. This is based on the docs for Android 2.3 r1 - 05 Jan 2011 12:43.

    See the documentation:

    Classes that define setFrame
    http://www.google.com/search?q=site:developer.android.com+%22boolean+setFrame%22

    TextView and ImageView.

    Edit:

    As the OP points out in the comments, the method is clearly defined in the View.java source code. However, the documentation acts as if the method isn’t defined there.

    The reason for this is that the setFrame() method in View has the @hide Javadoc tag:

    /**
     * Assign a size and position to this view.
     *
     * This is called from layout.
     *
     * @param left Left position, relative to parent
     * @param top Top position, relative to parent
     * @param right Right position, relative to parent
     * @param bottom Bottom position, relative to parent
     * @return true if the new size and position are different than the
     *         previous ones
     * {@hide}
     */
    protected boolean setFrame(int left, int top, int right, int bottom) {
    

    Apparently, this hides the method from the Javadoc:

    http://www.androidjavadoc.com/?p=63

    The especial [sic] attention is need to turn to the @hide tag which standard doclet can’t interpret and which hides non-SDK source and thus this code shouldn’t be used in applications.

    Is it possible that the reason it can’t be overridden is that the Eclipse plug-in for Android or the Android compiler is somehow enforcing the @hide tag? I don’t know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm simply trying to create a UML diagram where I can show the header
Is there a better way than simply trying to open the file? int exists(const
In a WinApp I am simply trying to get the absolute path from a
I'm trying to create simply connect with ActiveMQ using JNDI. I have: Queue named
I am trying to write a console app that simply lists the number of
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
I am currently trying to learn J2ME and build a connect four game (some
I was trying to understand how ajax works with django several times, but looks
I am trying to drag a view over the screen FrameLayout main = (FrameLayout)
I am trying to create a SIMPLE plugin, no interface is necessary, that will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.