title: Setting wallpaper
body: <p>Im trying to set my bitmap image as a wallpaper!</p>
  
  <p>Im currently using this code to get it done.</p>
  
  <pre><code>            WallpaperManager wpm = WallpaperManager.getInstance(this);
  
              float minH =  wpm.getDesiredMinimumHeight();
              float minW =  wpm.getDesiredMinimumWidth();
              Log.d("seb", minH + " = Min Height");
              Log.d("seb", minW + " = Min Width");
              targetBitmap = Bitmap.createScaledBitmap(targetBitmap,(int)minW, (int)minH, false);         
              wpm.setBitmap(targetBitmap);
  </code></pre>
  
  <p>It works! The phone automatically resizes the bitmap to fit the screen, but no mather how small my bitmap is, it's always cropped horizontally and scaled up.</p>
  
  <p>Does anyone know how to fix this?</p>
  
  <p><em>(One fix would be to put a black border around and have them cropped instead of the actual picture, though Im guessing there is a better alternative )</em></p>
  
  <p><strong>EDIT</strong></p>
  
  <p><img src="https://i.stack.imgur.com/hUUiS.png" alt="This is original picture"></p>
  
  <p>this is original picture in code.</p>
  
  <p>The following picture is what I mean with cropped when set to wallpaper:</p>
  
  <p><img src="https://i.stack.imgur.com/vWWLg.png" alt="Cropped picture"></p>
  
  <p>And this will be in the same way even if i resize the image since the system automatically enlarges the picture to fit the whole screen</p>