Android - Can't set a variable in Service class

view story

http://stackoverflow.com – i have a service class named ForegroundService where in onstartCommand i need to set a variable: @Override public int onStartCommand(Intent intent, int flags, int startId) { VariableManaging.isStop=false; //<==variable i need to set. Here i got an exceptioninInitializer error when my bootReceiver start service on startup. If service is start by button on activity got no error. } VariableManaging class start with: static boolean isStop=true; static ProgressDialog progressDialog=new ProgressDialog(Main.activity); //<== I noted that if i remove this all working well There' (HowTos)