how I'll be able to get data from Singleton class of java in kotlin class.? since my project is an old project and whole app is in java now I'm implementing its new module in kotlin where I'm using Java's Singleton (CurrentUser.java)
in kotlin's Service Class(UpdateWidgetService.kt)
.while I'm using this CurrentUser.getInstance().userType
code for getting type of user in My service class its throwing below exception
Process: com.example.myapp, PID: 27066
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/myapp/main/CurrentUser
Java
public class CurrentUser {
String userType = "";
private static CurrentUser instance;
public static CurrentUser getInstance() {
if (instance == null) {
instance = new CurrentUser();
}
return instance;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getUserType() {
return userType ;
}
}
Kotlin
CurrentUser.getInstance().userType