Reputation: 2123
First of all I'm not sure if this is Android specific, I have two packages with a subclass and I'm trying to import one subclass from the other subclass which doesn't seem to work. This has never occurred to me before, am I not supposed to do this?
Here you can see the error, "Exercise" cannot be resolved, yet I have tried to import it but that doesn't seem to work either.
All good when I move class "Exercise" into package "database".
Upvotes: 1
Views: 745
Reputation: 2276
Just check your Exercise
class declaration. If it is declared this way:
class Exercise {...}
You will never be able to import it because this is called package declaration which means that you only can declare it if you are in it's package. Do you understand? That's why when you move the class to the DatabaseQuery
package, it works fine.
But if the declaration of your class is something like:
public class Exercise {...}
Then you need to check your environment, clean caches or restart your IDE.
Upvotes: 1