Take the 2-minute tour ×



share|improve this question
Please explain what you mean by "I have created an interface for java.awt.Point and put import java.awt.Point in my code." Your error seems to be similar what we get when instantiating an interface. "error: cannot instantiate Point" –  bhatt4982 Sep 17 '09 at 8:51

4 Answers 4

up vote 4 down vote accepted

For Point class use android.graphics.Point

import android.graphics.Point;

share|improve this answer

Maybe just use android.graphics.Point instead?

I don't think there are any awt classes in Android other than NumericShaper and TextAttribute.

You can't create an interface for any class you want and hope it will be loaded automatically, save for instantiating it - interface is only a description. Android doesn't include the full Java Class Library, just a subset.

Here's a full list of currently used packages by Android.

share|improve this answer

The Android JVM does not have the full Java SE class library, nor does it conform to any J2ME profile. You can see which classes are part of the library here - AWT is missing completely. However, the android class library has its own Point and PointF classes for int and float coordinates.

share|improve this answer

In this case I think it's best to write your own Point class since java.awt.Point belongs to the AWT framework and using it outside this context is not really a good practice.

However if it's just an exercise in importing stuff it's ok. The error you get when trying to instantiate your interface (also named Point I presume) is normal you cannot instantiate a interface.

The second error where the import cannot be resolved is likely because the the AWT JAR is not added to your classpath. Are you using a IDE?

You should start with a basic Java tutorial I guess, but I can't seem to find a good one online at the moment. Maybe someone else knows where to find one.

share|improve this answer

Your Answer

