[Android Q&A, Help & Troubleshooting] NightscapeCreations:
I'm a very new Java developer, having started learning it last month specifically for this project. I have fifteen years of development experience, but it has almost all been web related (html, JS, JQuery, ColdFusion, etc), so this is a major paradigm change that I'm having trouble wrapping my head around.

Anyway, I'm attempting to create a movie-based live wallpaper to sell on the app store. I have a 15 second mpg (or 450 png frames) derived from some rendered artwork I did, the bottom 35% of which has motion (the rest remains relatively static). I'd like code flexible enough to handle future animations as well, though, as I just rediscovered Vue and may do other videos where the entire frame has motion.

My initial attempts are detailed on my Stack Overflow question at: (link removed due to forum rules; findable with the title: How do you create a video live wallpaper).

That post, in short, boils down to having tried these different approaches:

Load frames into a bitmap array and display on canvas in loop; excellent FPS but hundreds of MB of memory use.

Load frames into byteArray as jpgs and decode during display; clocking in at only 10 FPS at 60% cpu usage on powerful hardware, but with good memory usage.

Load tiled sprite with all 450 frames in AndEngine as a texture and display; went oom while trying to allocate 200 MB of memory.

AndEngine again. Load tiled jpg with 10 frames into sprite, load next tiled jpg into a second sprite, every 400ms hide one sprite and display the second, then load the upcoming jpg into the hidden sprite; rinse, repeat. Attempting to decode in a makeshift buffer, essentially.

I feel like maybe method 4 has promise and am including the code I'm using below. However, every time the sprites are swapped out the screen freezes for as long as a second or two. I tried adding timers between every line of code to determine what's taking so much time, but they almost always come back with barely a millisecond or two taken, leaving me confused about where the freeze is occurring. But I don't understand AndEngine well yet (or even Java) so I may be doing something completely boneheaded.

I'd welcome any thoughts, whether a refinement on an existing method or a completely new idea. I've had a horrible time trying to find tutorials on doing this, and questions I find here and on SO generally don't offer much encouragement. I just want to get this thing finished so I can concentrate on the heart of this project: the art. Thanks!

As an aside, how much work would this be (ie: how much would it cost) for an experienced developer to create a template for me? I wouldn't mind paying a small amount for something I can keep using with future animations.

public void onCreateResources(
OnCreateResourcesCallback pOnCreateResourcesCallback)
throws Exception {
scene = new Scene();
initializePreferences();

// Water
waterTexture = new BitmapTextureAtlas(this.getTextureManager(), 1200, 950, TextureOptions.BILINEAR);
waterRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(waterTexture, this.getAssets(), "testten1.jpg", 0, 0, 2, 5);
waterTexture.load();
waterTexture2 = new BitmapTextureAtlas(this.getTextureManager(), 1200, 950, TextureOptions.BILINEAR);
waterRegion2 = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(waterTexture2, this.getAssets(), "testten2.jpg", 0, 0, 2, 5);
waterTexture2.load();

water = new AnimatedSprite(0, 0, waterRegion, this.getVertexBufferObjectManager());
water2 = new AnimatedSprite(0, 0, waterRegion2, this.getVertexBufferObjectManager());
scene.attachChild(water);
water.animate(40);
mHandler.postDelayed(mUpdateDisplay, 400);
}

private final Handler mHandler = new Handler();
private final Runnable mUpdateDisplay = new Runnable() {
[MENTION=439709]override[/MENTION]
public void run() {
changeWater();
}
};

public void changeWater() {
mHandler.removeCallbacks(mUpdateDisplay);
mHandler.postDelayed(mUpdateDisplay, 400);
if (curWaterTexture == 1) {
Log.w("General", "Changed texture to 2 with resource: " + curWaterResource);
curWaterTexture = 2;
scene.attachChild(water2);
water2.animate(40);
scene.detachChild(water);

curWaterResource = curWaterResource + 1;
if (curWaterResource > 4) curWaterResource = 1;
String resourceName = "testten" + curWaterResource + ".jpg";
waterRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(waterTexture, this.getAssets(), resourceName, 0, 0, 2, 5);
waterTexture.load();
water = new AnimatedSprite(0, 0, waterRegion, this.getVertexBufferObjectManager());
} else {
Log.w("General", "Changed texture to 1 with resource: " + curWaterResource);
curWaterTexture = 1;
scene.attachChild(water);
water.animate(40);
scene.detachChild(water2);

curWaterResource = curWaterResource + 1;
if (curWaterResource > 4) curWaterResource = 1;
String resourceName = "testten" + curWaterResource + ".jpg";
waterRegion2 = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(waterTexture2, this.getAssets(), resourceName, 0, 0, 2, 5);
waterTexture2.load();
water2 = new AnimatedSprite(0, 0, waterRegion2, this.getVertexBufferObjectManager());
}
}