title: why android asks for a huge memory allocation for a small photo?
body: <p>I am trying to load a jpeg photo with a size of 965KB on my android phone. The code is below. When I run the code, the app crashes.</p>
  
  <pre><code>Button _btn = (Button) findViewById(R.id.btn1);
  _btn.setOnClickListener(new View.OnClickListener() {
  
       @Override
        public void onClick(View view) {
             Drawable _draw  = getResources().getDrawable(R.drawable.sea, null);
      }
  });
  </code></pre>
  
  <p>This is the crash log.</p>
  
  <blockquote>
    <p>E/AndroidRuntime: FATAL EXCEPTION: main
                                                                             Process: com.a3sumatch.multipart, PID: 29240
                                                                             java.lang.OutOfMemoryError: Failed to allocate a 362797068 byte
    allocation with 8388608 free bytes and 254MB until OOM
                                                                                 at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                                                 at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                                                 at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                                                                                 at
    android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                                                                                 at
    android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                                                                                 at
    android.content.res.Resources.loadDrawableForCookie(Resources.java:2761)
                                                                                 at android.content.res.Resources.loadDrawable(Resources.java:2654)
                                                                                 at android.content.res.Resources.getDrawable(Resources.java:833)
                                                                                 at
    com.a3sumatch.multipart.MainActivity$1.onClick(MainActivity.java:40)
                                                                                 at android.view.View.performClick(View.java:5205)
                                                                                 at android.view.View$PerformClick.run(View.java:21176)
                                                                                 at android.os.Handler.handleCallback(Handler.java:739)
                                                                                 at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                 at android.os.Looper.loop(Looper.java:171)
                                                                                 at android.app.ActivityThread.main(ActivityThread.java:5611)
                                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                                 at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
                                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)</p>
  </blockquote>