In my app, I have implemented a Token class as a singleton to handle user's identification. However, when I launch my app, it fails with the following error:
java.lang.RuntimeException: Unable to instantiate application appliflo.Token: java.lang.IllegalAccessException: private appliflo.Token() is not accessible from class android.app.Instrumentation
I am wondering weather this could be due to the Application class inheritance.
Here is my singleton:
package appliflo;
import android.app.Application;
public final class Token extends Application{
private static long TokenID;
private static Token instance;
private Token(){
}
private Token(long TokenID){
this.TokenID = TokenID;
}
public static synchronized Token getToken() {
if (instance == null) instance = new Token();
return instance;
}
public static synchronized void setToken(long id){
if (instance == null) instance = new Token(id);
instance.TokenID = id;
}
public long getTokenID(){
return this.TokenID;
}
}