title: Getting a FATAL EXCEPTION: main java.lang.OutOfMemoryError
body: <p>I am getting this error:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                java.lang.OutOfMemoryError
                    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
                    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:832)
                    at android.content.res.Resources.loadDrawable(Resources.java:2988)
                    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                    at android.view.View.&lt;init&gt;(View.java:3563)
                    at android.widget.ImageView.&lt;init&gt;(ImageView.java:125)
                    at android.support.v7.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:57)
                    at android.support.v7.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:53)
                    at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                    at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1013)
                    at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1072)
                    at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:690)
                    at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
                    at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
                    at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
                    at mario.fragments.SplashScreenSalir_Fragment.onCreateView(SplashScreenSalir_Fragment.java:30)
                    at android.app.Fragment.performCreateView(Fragment.java:1699)
                    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:903)
                    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1075)
                    at android.app.BackStackRecord.run(BackStackRecord.java:682)
                    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1455)
                    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441)
                    at android.os.Handler.handleCallback(Handler.java:730)
                    at android.os.Handler.dispatchMessage(Handler.java:92)
                    at android.os.Looper.loop(Looper.java:176)
                    at android.app.ActivityThread.main(ActivityThread.java:5419)
                    at java.lang.reflect.Method.invokeNative(Native Method)
                    at java.lang.reflect.Method.invoke(Method.java:525)
                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
                    at dalvik.system.NativeStart.main(Native Method)
  E/dalvikvm: Could not find class 'android.util.ArrayMap', referenced from method com.android.tools.fd.runtime.Restarter.getActivities
  W/dalvikvm: VFY: unable to resolve instanceof 2541 (Landroid/util/ArrayMap;) in Lcom/android/tools/fd/runtime/Restarter;
  D/dalvikvm: VFY: replacing opcode 0x20 at 0x006f
  
  12/10 01:19:15: Launching app
  I/Process: Sending signal. PID: 28067 SIG: 9
  Application terminated.
  </code></pre>
  
  <p>I have been reading about it, but I have just read about Virtual Machines, and I am getting it using my own phone.</p>
  
  <p>It is kind of weird, because the code actually works. I mean, after crashing, if I push again the button, it works (I attach a couple of images)</p>
  
  <p><a href="https://i.stack.imgur.com/PZho2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PZho2.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/ZQ2e6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZQ2e6.png" alt="enter image description here"></a></p>
  
  <p>The code of my Fragment is just a simple SplashScreen:</p>
  
  <pre><code>      package mario.fragments;
  
  
      import android.content.Intent;
      import android.os.Bundle;
      import android.os.Handler;
      import android.app.Fragment;
      import android.view.LayoutInflater;
      import android.view.View;
      import android.view.ViewGroup;
  
      import mario.rankit.MainActivity;
      import mario.rankit.R;
  
          /**
           * A simple {@link Fragment} subclass.
           */
          public class SplashScreenSalir_Fragment extends Fragment {
              View view;
  
              pu
  
  blic SplashScreenSalir_Fragment() {
              // Required empty public constructor
          }
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          view = inflater.inflate(R.layout.fragment_splash_screen_salir_, container, false);
  
          new Handler().postDelayed(new Runnable() {
              @Override
              public void run() {
                  Intent intent = new Intent(view.getContext(), MainActivity.class);
                  startActivity(intent);
              }
          }, 3000);
  
          return view;
      }
  
  }
  </code></pre>
  
  <p>Do you know how to solve it?</p>