3

I keep getting this error about No enclosing instance of my WallpaperService is available. So my program will not compile. What exactly does this error mean...?

Where should I go from here. Below is my constructor for myEngine class. The error happens at my super(); method call.

public final class myEngine extends Engine implements OnSharedPreferenceChangeListener {
    LWPService a;
    private i b;
    private SharedPreferences c;
    private LWPService r4_LWPService;

    myEngine(LWPService lwpService) {
        super();
        this.a = r4_LWPService;
        this.b = new i(getSurfaceHolder(),
                r4_LWPService.getApplicationContext());
        this.c = r4_LWPService.getSharedPreferences("settings", 0);
        this.c.registerOnSharedPreferenceChangeListener(this);
        onSharedPreferenceChanged(this.c, null);
    }
... OTHER CODE...

}

Here is the LWPService class

public class LWPService extends WallpaperService {
    public void onCreate() {
        super.onCreate();
    }

    public Engine onCreateEngine() {
        return new m(this);
    }

    public void onDestroy() {
        super.onDestroy();
    }
Randolph
  • 951
  • 2
  • 11
  • 24

1 Answers1

0

Your myEngine class should not be static - make it as inner class for LWPService.

Ircover
  • 2,406
  • 2
  • 22
  • 42