title: Android - A different Bitmap wallpaper for every home screen - OutOfMemory
body: <p>I am trying to set a different wallpaper for every home screen, but I get OutOfMemory issues. I have 5 Bitmaps which I am trying to overlay on a wallpaper Bitmap which is 5 times the display width. Using the code below I get OOM. The problem seems to be the first line of code which creates the large wallpaper Bitmap. My question is whether there is a way to do this (i.e. some way that takes up less memory, or someway to allocate more memory??). Thanks!</p>
  
  <pre><code> Bitmap wallpaper = Bitmap.createBitmap(displayWidth*5,displayHeight, Config.ARGB_8888);
   Canvas canvas = new Canvas(wallpaper);
   Uri data = getIntent().getData();
   Bitmap bmp = getBitmap(data, imagePosition, displayWidth, displayHeight);
   canvas.drawBitmap(bmp, 0, 0,null);
   WallpaperManager wallpaperManager = (WallpaperManager) SetterActivity.this.getSystemService(Context.WALLPAPER_SERVICE);
   wallpaperManager.setBitmap(wallpaper);
   wallpaperManager.suggestDesiredDimensions(bmp.getWidth()*2, bmp.getHeight());
  </code></pre>