2

I'm little confused about setting up wallpaper, In my galaxy s if i set wallapaper through code then it's not scrolling by default but If galary sets the wallpaper then its scrolling

Avoid a wallpaper to stretch across 5 screens

It depends on Home luncher app but how can i manage scrolling enabled disabled in my code

// the content of our screen.
    setContentView(R.layout.wallpaper_2);
    final WallpaperManager wallpaperManager = WallpaperManager
            .getInstance(this);
    final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
    final ImageView imageView = (ImageView) findViewById(R.id.imageview);
    imageView.setDrawingCacheEnabled(true);
    imageView.setImageDrawable(wallpaperDrawable);

    Button randomize = (Button) findViewById(R.id.randomize);
    randomize.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            int mColor = (int) Math.floor(Math.random() * mColors.length);
            wallpaperDrawable.setColorFilter(mColors[mColor],
                    PorterDuff.Mode.MULTIPLY);
            imageView.setImageDrawable(wallpaperDrawable);
            imageView.invalidate();
        }
    });

    Button setWallpaper = (Button) findViewById(R.id.setwallpaper);
    setWallpaper.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            try {
                wallpaperManager.setBitmap(imageView.getDrawingCache());
                finish();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });

wallpaperwizardrii application support scrolling and not scrolling features, It means it is possible at place but after investing so much time i failed to get solution.

I tried to set wallpaperManager.setWallpaperOffsetSteps(xStep, yStep); but can not get result of it Am I missing any api which i am not aware

Help me Thanks in advance...

EDIT:I am setting one wallpaper in my phone from below code its result is ok because im having ICS in my phone but in emulator its stretched.

WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
            R.drawable.dashboard);
    Bitmap useThisBitmap = Bitmap.createScaledBitmap(bitmap,
            wallpaperManager.getDesiredMinimumWidth(),
            wallpaperManager.getDesiredMinimumHeight(), true);
    bitmap.recycle();

    try {
        wallpaperManager.setBitmap(useThisBitmap);
    } catch (IOException e) {
        e.printStackTrace();
    }

    Log.e("", "Width : " + wallpaperManager.getDesiredMinimumWidth());
    Log.e("", "Height : " + wallpaperManager.getDesiredMinimumHeight());

Is there any relation with offset??

Community
  • 1
  • 1
Bhavesh Hirpara
  • 22,255
  • 15
  • 63
  • 104

0 Answers0