Reputation: 19
I am getting the method getX()
is undefined for the type Point
my code is
public void addNewPoints(Point p) {
dataset.add(p.getX(), p.getY());
}
please help me how resolve this error
Upvotes: 1
Views: 1312
Reputation: 127
under source generate getters and setters but first you need something to get and set like this
class Point{
private int x;
private int y;
public void addNewPoints(Point p) {
dataset.add(p.getX(), p.getY());
}
}
Its a long story why private variables public methods to get and set variables, encapsulation, best practice.
Upvotes: 0
Reputation: 39807
You're confusing java.awt.Point
with android.graphics.Point
. The Android Point
, documented at http://developer.android.com/reference/android/graphics/Point.html, has public int x
and int y
data members, while the AWT Point does have the getX()
method.
Upvotes: 0
Reputation: 54322
Its because the class Point
doesn't contain a public method named getX()
.
Upvotes: 1