Android: how to import a class that I created?

I am following the Hello documentation , MapView for Android.

I followed this most of the way, including creating the HelloItemizedOverlay class, but when I get to this section:

List<Overlay> mapOverlays;
Drawable drawable;
HelloItemizedOverlay itemizedOverlay;

I suddenly start to get errors in speaking HelloItemizedOverlay cannot be resolved to a type.

I suppose this is because I did not import the class (there is usually no instruction for this in the documentation), but how do I import the class that I created in my project?

+3
source share
3 answers

Move the HelloItemizedOverlay.java class to the package where the Java file is located, from which you call HelloItemizedOverlay

+1
source

add the class to the jar file, then right-click on your project, go to BuildPath> Set Build Path, and then place your jar on the libraries tab. You can also try simply deleting the .class file in the src folder on hdd and updating your project.

0
source

Source: https://habr.com/ru/post/1781685/


All Articles