Swati Rawat
Swati Rawat

Reputation: 1729

Android Live Wallpaper onOffsetsChanged

I am trying to make a live wallpaper. I understand that onOffsetsChanged method is used to get the current position of the screen. I am not able to properly understand how to implement this method to get the livewallpaper or just even a standard wallpaper to move sideways along with the user swipes. I tries looking through some examples but still i am not clear. Can someone give me an idea and suggest some good tutorial for a live wallpaper that can move across the screen with user swipes. Thanks in advance!

Upvotes: 1

Views: 1390

Answers (1)

user3645487
user3645487

Reputation: 11

you need to make

public float mmPixel;

and then

    public void onOffsetsChanged(float xOffset, float yOffset, float xStep,
            float yStep, int xPixels, int yPixels) {

        mmPixel = xPixels;



    }

and draw your Bitmap like this on Canvas c

    c.drawBitmap(Bitmap bitmap, mmPixel, 0, null);

Upvotes: 1

Related Questions