title: error at setContentView - android.view.InflateException
body: <p>I have a splash screen which shows a image for 2 sec. The image is a PNG image. When I start my APP sometimes it crashes with the following error messages. The exact line where my app crashes is setContentView(R.layout.splash);</p>
  
  <p>key error lines :
  I could see there is some error with reference to java.lang.OutOfMemoryError while inflating the layout</p>
  
  <p>Could you please let tell me where I need to correct my code.</p>
  
  <h2>XML</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout  
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="fill_parent"  
  android:layout_height="fill_parent" 
  android:background="@drawable/splash"&gt;  
  
  &lt;/RelativeLayout&gt; 
  </code></pre>
  
  <h2>Java Code:</h2>
  
  <pre><code> public class Splash extends Activity{
  @Override
  protected void onCreate(Bundle GoOnSudha) {
      // TODO Auto-generated method stub
      super.onCreate(GoOnSudha);
  
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
      setContentView(R.layout.splash);
  
      Thread thread = new Thread(){
          public void run(){
              try{
                  sleep(2000);
              } catch (InterruptedException e){
                  e.printStackTrace();
              }finally{
                  Intent dragDropIntent = new Intent("android.intent.action.DRAGDROP");
                  startActivity(dragDropIntent);
              }
          }
      };
      thread.start();
  }
  
  @Override
  protected void onPause() {
      // TODO Auto-generated method stub
      super.onPause();
      finish();
  }
  
  }
  </code></pre>
  
  <h2>LogCat:</h2>
  
  <pre><code>05-04 19:34:05.651: E/AndroidRuntime(28305): FATAL EXCEPTION: main
  05-04 19:34:05.651: E/AndroidRuntime(28305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.DragDrop/com.example.DragDrop.Splash}: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.ActivityThread.access$600(ActivityThread.java:127)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.os.Handler.dispatchMessage(Handler.java:99)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.os.Looper.loop(Looper.java:137)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.ActivityThread.main(ActivityThread.java:4441)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at java.lang.reflect.Method.invokeNative(Native Method)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at java.lang.reflect.Method.invoke(Method.java:511)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at dalvik.system.NativeStart.main(Native Method)
  05-04 19:34:05.651: E/AndroidRuntime(28305): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.createView(LayoutInflater.java:606)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:255)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.Activity.setContentView(Activity.java:1835)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at com.example.DragDrop.Splash.onCreate(Splash.java:18)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.Activity.performCreate(Activity.java:4465)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
  05-04 19:34:05.651: E/AndroidRuntime(28305): ... 11 more
  05-04 19:34:05.651: E/AndroidRuntime(28305): Caused by: java.lang.reflect.InvocationTargetException
  05-04 19:34:05.651: E/AndroidRuntime(28305): at java.lang.reflect.Constructor.constructNative(Native Method)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.LayoutInflater.createView(LayoutInflater.java:586)
  05-04 19:34:05.651: E/AndroidRuntime(28305): ... 23 more
  05-04 19:34:05.651: E/AndroidRuntime(28305): Caused by: java.lang.OutOfMemoryError
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.Bitmap.nativeCreate(Native Method)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:530)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:505)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:357)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:777)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.content.res.Resources.loadDrawable(Resources.java:1940)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.View.&lt;init&gt;(View.java:2844)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.View.&lt;init&gt;(View.java:2781)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:412)
  05-04 19:34:05.651: E/AndroidRuntime(28305): at android.widget.RelativeLayout.&lt;init&gt;(RelativeLayout.java:179)
  05-04 19:34:05.651: E/AndroidRuntime(28305): ... 26 more
  </code></pre>