title: OutOfMemoryError in Java?
body: <p>When i open gallery display a image in imageview i'm getting <code>OutOfMemoryError</code>. Just click a button and open a mobile gallery and select the image from gallery and set into imageview. 
  I have got this error.</p>
  
  <p><strong>LogCat</strong></p>
  
  <pre><code>07-12 16:38:41.628: E/AndroidRuntime(5746): FATAL EXCEPTION: main
  07-12 16:38:41.628: E/AndroidRuntime(5746): java.lang.OutOfMemoryError
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:652)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:724)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at com.konylabs.api.ui.bl.e(Unknown Source)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at com.konylabs.api.ui.fz.a(Unknown Source)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at com.konylabs.api.ui.hb.run(Unknown Source)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.os.Handler.handleCallback(Handler.java:615)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.os.Handler.dispatchMessage(Handler.java:92)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.os.Looper.loop(Looper.java:137)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at android.app.ActivityThread.main(ActivityThread.java:4921)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at java.lang.reflect.Method.invoke(Method.java:511)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
  07-12 16:38:41.628: E/AndroidRuntime(5746):     at dalvik.system.NativeStart.main(Native Method)
  07-12 16:38:41.648: E/android.os.Debug(2105): !@Dumpstate &gt; dumpstate -k -t -z -d -o /data/log/dumpstate_app_error
  </code></pre>
  
  <p><strong>Java code:</strong></p>
  
  <pre><code>function onselectioncallback(image)
          {
              var base_64 = kony.convertToBase64(image);
              PhoneAPI.img.base64 = base_64
          }
  function open_media()
  {
          var querycontext = {mimetype:"image/*"};
          returnStatus = kony.phone.openMediaGallery(onselectioncallback, querycontext);
  }
  </code></pre>