title: Android live wallpaper - onOffsetsChanged args never change
body: <p>I'm trying to adapt Google's CubeLiveWallpaper demo to create a parallax effect in a live wallpaper.  I've removed the cube and have my own image displaying and that's great, but I've hit a wall.</p>
  
  <p>My understanding is that I'm supposed to be able to use xPixels from onOffsetsChanged() to determine where to draw my bitmap on the canvas.  Assuming I'm not already talking crazy, logic would dictate that xPixels would have to be a different value every time the user makes a swipe.  I have proven with a log statement that this is not happening.  In fact, none of the values received by onOffsetsChanged() ever change.  The result is that my image does not move.</p>
  
  <p>First, I'll provide the log output, then the code.</p>
  
  <p><strong>Log (copied from Dalvik Debug Monitor).  Every swipe, in either direction, produces this output.</strong></p>
  
  <pre><code>02-23 20:09:29.859: D/onOffsetsChanged(1039): xOffset (0.500000) | yOffset (0.000000) | xStep (0.000000) | yStep (0.000000) | xPixels (-160) | yPixels (0)
  </code></pre>
  
  <p><strong>onOffsetsChanged</strong></p>
  
  <pre><code>  public void onOffsetsChanged( float xOffset, float yOffset, float xStep, float yStep, int xPixels, int yPixels )
    {
       Log.d( "onOffsetsChanged", String.format("xOffset (%f) | yOffset (%f) | xStep (%f) | yStep (%f) | xPixels (%d) | yPixels (%d)",
              xOffset,
              yOffset,
              xStep,
              yStep,
              xPixels,
              yPixels) );
  
       mOffset = xPixels;  // mOffset is a member of my class
       drawFrame();
    }
  </code></pre>
  
  <p>I figure that including the below code is unnecessary, since the drawing operations come after mOffset is assigned in onOffsetsChanged, but seeing as how I'm the one asking for help here, I've lost all right to assume things.</p>
  
  <p><strong>drawFrame()</strong></p>
  
  <pre><code>  void drawFrame()
    {
       final SurfaceHolder holder = getSurfaceHolder();
  
       Canvas c = null;
  
       try
       {
          c = holder.lockCanvas();
  
          if( c != null )
          {
             drawBackdrop( c );
          }
       }
       finally
       {
          if( c != null )
          {
             holder.unlockCanvasAndPost( c );
          }
       }
  
       mHandler.removeCallbacks( drawFrameRunnable );
  
       if( mVisible )
       {
          mHandler.postDelayed( drawFrameRunnable, 1000 / 25 );
       }
    }
  </code></pre>
  
  <p><strong>drawBackdrop()</strong></p>
  
  <pre><code>  void drawBackdrop( Canvas c )
    {
       c.save();
       c.drawColor( Color.BLACK );
  
       c.drawBitmap( backdropBmp,
                     mOffset,
                     0,
                     null );
       c.restore();
    }
  </code></pre>
  
  <p>As a final note, I'll mention that as far as I know, my phone supports scrolling wallpapers.  I understand that the Galaxy S3, for example, does not (source:  <a href="http://androidforums.com/samsung-galaxy-s3/586033-galaxy-s3-cheated-some-us-leaving-out-scrolling-wallpapers.html" rel="nofollow">http://androidforums.com/samsung-galaxy-s3/586033-galaxy-s3-cheated-some-us-leaving-out-scrolling-wallpapers.html</a>).  I have downloaded several live wallpapers from the Play store and they've all successfully scrolled.  I assume those developers haven't somehow jumped through a bunch of hoops to hack on the same functionality for my device.  I'm using a Samsung Transform Ultra.</p>
  
  <p>Thank you for your help!</p>