1

Basically have been trying to set the wallpaper through a location based app.

WallpaperManager wManager;
Bitmap bitmap;
try {
    bitmap = BitmapFactory.decodeFile(wallSrc);
    wManager = WallpaperManager.getInstance(getApplicationContext());
    wManager.setBitmap(bitmap);
}
catch (Exception e) {
    e.printStackTrace();
}

Profiling the code points out that the line

wManager.setBitmap(bitmap);

is acting as the culprit here. This seems to be taking an irrationally high amount of time to execute. Any faster mechanism to do the same? or to rephrase the question- Knowing the path to an image, what would be the fastest way to set it as a wallpaper?

Raul-
  • 147
  • 1
  • 11

1 Answers1

3

setStream might be faster as you don't have to manually decode the bitmap. Realistically though, something has to decode it... Most likely you're just using too large of a bitmap.

kabuko
  • 36,028
  • 10
  • 80
  • 93