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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:36:10+00:00 2026-06-14T04:36:10+00:00

I am following an online tutorial for a live wallpaper. During this I have

  • 0

I am following an online tutorial for a live wallpaper. During this I have encountered a problem which I find peculiar. The problem is that the constructor MyPoint in the code below says that it is getting String, int, int and that it needs String, float, float. However, the x and y in this constructor reference to the local floats x and y. I checked by selecting x or y in the constructor, and the local floats x or y would light up, so it should be getting floats as input. So why does it give this error?

@Override
public void onTouchEvent(MotionEvent event) {
if (touchEnabled) {

  float x = event.getX();
  float y = event.getY();
  SurfaceHolder holder = getSurfaceHolder();
  Canvas canvas = null;
  try {
    canvas = holder.lockCanvas();
    if (canvas != null) {
      canvas.drawColor(Color.BLACK);
      circles.clear();
      circles.add(new MyPoint(String.valueOf(circles.size() + 1), x, y));
      drawCircles(canvas, circles);

    }
  } finally {
    if (canvas != null)
      holder.unlockCanvasAndPost(canvas);
  }
  super.onTouchEvent(event);
}
}

EDIT:

The exact error is: “The constructor MyPoint(String, float, float) is undefined”

With quick fix option: “Change constructor MyPoint(String, int, int) to MyPoint(String, float, float)”

  • 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-06-14T04:36:11+00:00Added an answer on June 14, 2026 at 4:36 am

    A constructor does not request anything. It requires values of whatever type you have defined in the constructor signature. If you do not supply values of the correct type, then the compiler cannot compile your code since you have told it to instantiate an instance of MyPoint via it’s constructor receiving String, float, float which does not exist.

    So the error is, as a minimum, in your “MyPoint” class. You might also have an error in the code you’ve shown if indeed the MyPoint constructor requires ints. However, looking at your code, it seems that float is more likely.

    The error, and it’s solution, are straightforward.

    In MyPoint, you have

    public MyPoint(String name, int x, int y);
    

    You should also have

    public MyPoint(String name, float x, float y);
    

    I am assuming that you want both. If you have no need for a constructor receiving x and y as ints, then simply change it.

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

Sidebar

Related Questions

I have been following this tutorial, online http://ruby.railstutorial.org/chapters/sign-in-sign-out?version=3.2#top and in part 8.2.3 there is
I'm very new to Git and I've been following this online tutorial for converting
After following a tutorial online to make a basic program which uses Get and
I am learning castle.windsor following the tutorial online. this is the simple sample code:
I have tried following the Kiwi tutorial online and haven't managed to get further
I am reading an online JavaScript tutorial in which is claimed the following code
so I am working on a game, following a tutorial online. Currently I have
I am following this tutorial online to the letter. http://www.tutorialspoint.com/spring/spring_bean_life_cycle.htm But I get the
Searching online, I have found the following routine for calculating the sign of a
I just spotted the following in an online tutorial. It showed 001 as a

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.