title: Live Wallpaper Screen Rotation
body: <p>I am currently working on a live wallpaper that is very intensive and does not handle screen rotation very well.</p>
  
  <p>In fact the wallpaper is destroyed and displays a blank screen without calling onSurfaceChanged!</p>
  
  <p>Here is what I have within the onSurfaceChanged method:</p>
  
  <pre><code>@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 &gt; 1) {
              orientation = 0;
          }
          if (mRatio &lt; 1) {
              orientation = 1;
          }
          setRunning(true);
          Log.i(TAG, "Screen Rotation...");
          mHandle.post(r);
      }
  </code></pre>
  
  <p>I am positive this method does not get called because there is no log message. </p>
  
  <p>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?</p>
  
  <p>Also, onVisibilityChanged is not called as well and when I open apps on the emulator, there is no log message:</p>
  
  <pre><code>@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);
          }
      }
  </code></pre>