title: Can I catch out of memory exception in Android in Bitmap allocation for decoding a picture file?
body: <p>I tried to put a catch around the picture file decoding, but it fails to catch the out of memory exception, and the app crashes.</p>
  
  <p>I know some tricks in decode a picture file, such as subsampling.
  But I need to zoom in the picture to see details, so I cannot subsample it too much.
  For some newer devices, it can succeed to allocate a larger memory to avoid the out of memory exception.</p>
  
  <p>For some older devices, it cannot.</p>
  
  <p>If I can customize my applicaiton for different devices, that would be greate.</p>
  
  <p>So I want:
  (1) I hope I can catech the out of memory exception, so in case I catch it, I can reduce the image size.
  (2) Or, I hope I can get the size of available memory for allocation.</p>
  
  <p>I search online, fail to find answers.</p>