I am currently working on a live wallpaper that is very intensive and does not handle screen rotation very well.
In fact the wallpaper is destroyed and displays a blank screen without calling onSurfaceChanged!
Here is what I have within the onSurfaceChanged method:
@Override
public void onSurfaceChanged(SurfaceHolder holder, int format,
int width, int height) {
// TODO Auto-generated method stub
super.onSurfaceChanged(holder, format, width, height);
mRatio = (float) width / height;
if (mRatio > 1) {
orientation = 0;
}
if (mRatio < 1) {
orientation = 1;
}
setRunning(true);
Log.i(TAG, "Screen Rotation...");
mHandle.post(r);
}
I am positive this method does not get called because there is no log message.
Why is this happening and what are some techniques for handling screen rotation? Could it be that my live wallpaper is so intensive the void cannot be called?
Also, onVisibilityChanged is not called as well and when I open apps on the emulator, there is no log message:
@Override
public void onVisibilityChanged(boolean visible) {
// TODO Auto-generated method stub
super.onVisibilityChanged(visible);
if (visible) {
setRunning(true);
Log.i(TAG, "Visible...");
mHandle.postDelayed(r, 2000);
} else {
setRunning(false);
Log.i(TAG, "Invisible...");
mHandle.removeCallbacks(r);
}
}