我正在尝试从我在这里找到的动态壁纸教程中执行以下操作。
/**
* Do the actual drawing stuff
*/
private void doDraw(Canvas canvas) {
Bitmap b = BitmapFactory.decodeResource(context.getResources(), IMAGES[current]);
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(b, 0, 0, null);
Log.d(TAG, "Drawing finished.");
}
/**
* Update the animation, sprites or whatever.
* If there is nothing to animate set the wait
* attribute of the thread to true
*/
private void updatePhysics() {
// if nothing was updated :
// this.wait = true;
if(previousTime - System.currentTimeMillis() >= 41) { //24 FPS
current = current < IMAGES.length ? current++ : 0;
}
Log.d(TAG, "Updated physics.");
}
但这似乎不起作用。我究竟做错了什么。“绘图完成”。和“更新物理”。消息正在打印。但我只看到第一张图片。我正在模拟器上测试它。
任何帮助,将不胜感激。谢谢