Live Wallpaper Engine Abstraction

Posted by user1459142 on Stack Overflow See other posts from Stack Overflow or by user1459142
Published on 2012-06-25T03:00:02Z Indexed on 2012/06/25 3:15 UTC
Read the original article Hit count: 108

I am trying to obtain an instance of my live wallpaper engine in another class, here is my code...

In the other class:

WallpaperEngine wpe = (WallpaperEngine) LiveWallpaperService.onCreateEngine();

In LiveWallpaperService:

@Override
public Engine onCreateEngine() {
    // TODO Auto-generated method stub
    return new WallpaperEngine();
}

But when I refer to an object in my engine (i.e, "wpe.variable"), I get a NullPointerException and the wallpaper force closes.

© Stack Overflow or respective owner

Related posts about android

Related posts about class