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 3879018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:40:43+00:00 2026-05-19T22:40:43+00:00

I need to override onMeasure method but when trying to override I get error:

  • 0

I need to override onMeasure method but when trying to override I get error:
The method OnMeasure(int, int) of type DrawLnClass.DrawLn must override a superclass method

Here is my code:

public class DrawLnClass extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(new DrawLn(this));
    }
    public class DrawLn extends View {

        Paint _paint;
        int _height;
        int _width;
        Bitmap _bitmap;
        Canvas _canvas;
        Point[] xLine;
        Point[] yLine;

        public DrawLn(Context context) {
            super(context);
            _paint = new Paint();
            _paint.setColor(Color.CYAN);
            _paint.setStyle(Paint.Style.STROKE);
        }

        @Override
        protected void OnMeasure(int widthMeasureSpec, int heightMeasureSpec)
        {
            //super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            _width = View.MeasureSpec.getSize(widthMeasureSpec);
            _height = View.MeasureSpec.getSize(heightMeasureSpec);

            Toast.makeText(getContext(), "Width = " + _width, Toast.LENGTH_SHORT).show();
            Toast.makeText(getContext(), "Height = " + _height, Toast.LENGTH_SHORT).show();

            setMeasuredDimension(_width, _height);  

            //_bitmap = Bitmap.createBitmap(_width, _height, Bitmap.Config.ARGB_8888);
            //_canvas = new Canvas(_bitmap);

            //calcLinePlacements();
            //drawBoard();

        }
  • 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-19T22:40:43+00:00Added an answer on May 19, 2026 at 10:40 pm

    You capitalised the first O, it should be onMeasure not OnMeasure.

    I bet you are glad you used @Override though, otherwise you wouldn’t have realised the method wasn’t correctly overriding.

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

Sidebar

Related Questions

I need to override Equals() method for one of my types but it seems
I need to override the behavior of the find method of a class from
I just need to override the show() method for the Toast class. I created
I've got a table with CSS3 alternating row styles but I need to override
I need to override Tabcontrol GetTabRect. protected override Rectangle GetTabRect(int index) {...} I receive
I need to override Zend_Controller_Action_Helper_Redictor method redirectAndExit(). I create My_Controller_Action_Helper_Redirector and put file with
In my Android application I need to Override the onResume() method to check which
I'm working with DelayedJob and I need to override a method that I thought
I need to override a method defined by a kext to do my own
I strongly need to override JSF 2.0 Content-Type header. Default it is Content-Type:application/xhtml+xml; charset=UTF-8

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.