I am currently working on live wallpapers that are very intense and do not handle screen rotation very well.
In fact, the wallpaper is destroyed and a blank screen is displayed without calling onSurfaceChanged!
Here is what I have in the onSurfaceChanged method:
@Override
public void onSurfaceChanged(SurfaceHolder holder, int format,
int width, int height) {
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 sure that this method is not called because there is no log message.
Why is this happening and what are the methods for processing screen rotation? Could it be that my live wallpapers are so intense that the void cannot be called?
In addition, onVisibilityChanged is also not called, and when I open the applications on the emulator, there is no log message:
@Override
public void onVisibilityChanged(boolean visible) {
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);
}
}
source
share