title: High resolution Image - OutOfMemoryError
body: <p>I am developing an application for the Galaxy S4.
  One of the requirements of the application is having a SplashScreen containing an Image of <strong>1920x1080</strong> pixels. Its a high quality .jpeg image and the size of the Image is about <strong>2 Megabytes</strong>.</p>
  
  <p>The problem is that I am getting an <strong>OutOfMemoryError</strong> as soon as I start the Application. I am quite stunned that this already happens with an image of just 2 megabyte in size? <strong>How can I fix this problem and display the image?</strong></p>
  
  <blockquote>
    <p>Changing the dimensions or the size of the image is not an option.</p>
  </blockquote>
  
  <p>SplashScreen.java</p>
  
  <pre><code>public class Splashscreen extends Activity {
  
  private static final int SPLASH_DURATION = 2000;
  private boolean isBackPressed = false; 
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN);
      super.onCreate(savedInstanceState);
      setContentView(R.layout.splashscreen);
  
      Handler h = new Handler();
  
      h.postDelayed(new Runnable() {
  
          @Override
          public void run() {
  
              // check if the backbutton has been pressed within the splash_duration
              if(!isBackPressed) { 
  
                  Intent i = new Intent(Splashscreen.this, MainActivity.class);
                  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                  Splashscreen.this.startActivity(i);
                  overridePendingTransition(R.anim.short_fade_in, R.anim.short_fade_out);
              }       
  
              finish();
          }
      }, SPLASH_DURATION);
  }
  
  @Override
  public void onBackPressed() {
  
      isBackPressed = true;
      super.onBackPressed();
  }
  }
  </code></pre>
  
  <p>And the splashscreen.xml</p>
  
  <pre><code>    &lt;ImageView 
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/ivSplashScreenImage"
          android:layout_width="match_parent"
          android:layout_height="match_parent" 
          android:scaleType="fitXY"
          android:src="@drawable/high_res_splashscreen_image"/&gt;
  </code></pre>
  
  <p><strong>ADDITIONAL INFORMATION:</strong></p>
  
  <p>Sometimes, (when a lot of device memory is available) the app is able to make it past the splash screen, but then, <strong>the memory consumption of the app is just insane</strong>. <strong>(around 100 megabyte)</strong>. Even though I close the SplashScreen Activity and finish() it, it seems that there is <strong>a reference to the ImageView / the Image kept in memory.</strong> </p>
  
  <p><strong>How can I reduce the huge memory consumption?</strong></p>
  
  <blockquote>
    <p>When I do not display the splash screen, my app only consumes around 35MB
    of memory. With the SplashScreen image, its around 100MB.</p>
  </blockquote>