title: Android : Maximum allowed width & height of bitmap
body: <p>Im creating an app that needs to decode large images to bitmaps to be displayed in a ImageView.</p>
  
  <p>If i just try to decode them straight to a bitmap i get the following error
  " Bitmap too large to be uploaded into a texture (1944x2592, max=2048x2048)"</p>
  
  <p>So to be able to show images with too high resolution im using: </p>
  
  <pre><code>Bitmap bitmap = BitmapFactory.decodeFile(path);
  
  if(bitmap.getHeight()&gt;=2048||bitmap.getWidth()&gt;=2048){
      DisplayMetrics metrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(metrics);
      int width = metrics.widthPixels;
      int height = metrics.heightPixels;
      bitmap =Bitmap.createScaledBitmap(bitmap, width, height, true);             
  }
  </code></pre>
  
  <p>This works but I don't really want to hardcode the maximum value of 2048 as I have in the if-statement now, but I cant find out how to get a the max allowed size of the bitmap for a device</p>
  
  <p>Any ideas? </p>