I have made a simple live wallpaper in Andengine. In it, I have used a timerHanlder
which is rotating the circle. But the problem is when I use it as the live wallpaper the timerhandler
does not work and the sprite
is static(not rotating) on scene. Here is the code. I cant't firgure out what the problem might be. Please help me.
{
BitmapTextureAtlas firstCircleAtlas;
ITextureRegion firstCircleRegion;
Sprite firstCircle;
Scene mScene;
int angle=0;
@Override
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception {
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
firstCircleAtlas=new BitmapTextureAtlas(128,128,TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.mEngine.getTextureManager().loadTexture(firstCircleAtlas);
firstCircleRegion=BitmapTextureAtlasTextureRegionFactory.createFromAsset(firstCircleAtlas, getApplicationContext(), "3.png", 0, 0);
firstCircle=new Sprite(0,0,firstCircleRegion);
mScene=new Scene();
mScene.attachChild(firstCircle);
mEngine.setScene(mScene);
firstCircle.setRotation(90);
mScene.registerUpdateHandler(new TimerHandler(1f, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
if(angle==360)
{
angle=0;
}
angle++;
firstCircle.setRotation(angle);
}
}));
}
@Override
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback)
throws Exception {
}
@Override
public void onPopulateScene(Scene pScene,OnPopulateSceneCallback pOnPopulateSceneCallback) throws Exception {
}
}
}
}