title: my application sometimes has stopped
body: <p>my android application when click button it must go to another layout .. sometimes it go correctly and sometimes it has stopped .. 
  in some devices it work everytime and in another devices it sometimes work and sometimes doesn't work . </p>
  
  <p>Here's my xml file for the layout which i have to go for :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".weddingActivity" &gt;
  
  &lt;LinearLayout 
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical"
  tools:context=".weddingActivity" &gt;
  
   &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="enter your text here"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;EditText
      android:id="@+id/etFName"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:ems="10" /&gt;
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="choose your frame"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
     &lt;ImageView
      android:id="@+id/w1"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w1" /&gt;
  
  &lt;ImageView
      android:id="@+id/w3"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w3" /&gt;
   &lt;ImageView
      android:id="@+id/w4"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w4" /&gt;
    &lt;ImageView
      android:id="@+id/w5"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w5" /&gt;
    &lt;ImageView
      android:id="@+id/w6"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w6" /&gt;
     &lt;ImageView
      android:id="@+id/w7"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w7" /&gt;
       &lt;ImageView
      android:id="@+id/w8"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w8" /&gt;
         &lt;ImageView
      android:id="@+id/w9"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w9" /&gt;
              &lt;ImageView
      android:id="@+id/w10"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w10" /&gt;
                       &lt;ImageView
      android:id="@+id/w11"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w11" /&gt;
    &lt;ImageView
      android:id="@+id/w12"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w12" /&gt;
    &lt;ImageView
      android:id="@+id/w14"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w14" /&gt;
    &lt;ImageView
      android:id="@+id/w15"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w15" /&gt;
     &lt;ImageView
      android:id="@+id/w16"
      android:layout_width="122dp"
      android:layout_height="111dp"
      android:clickable="true"
      android:onClick="onClick"
      android:src="@drawable/w16" /&gt;
  &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>and this is my weddingActivity.java (( which I have to go to )): </p>
  
  <pre><code>package com.example.invitationcard;
  
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.widget.Button;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.EditText;
  import android.widget.ImageButton;
  import android.widget.Toast;
  import android.widget.ImageView;
  
  
  public class weddingActivity extends ActionBarActivity {
  Button button;
  ImageView imageView ;
   EditText etFName;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.wedding);
  addListenerOnImagew1() ;  
  
  etFName = (EditText) findViewById(R.id.etFName);
  }
  
  public void addListenerOnImagew1() {
  
      final Context context = this;
  
      imageView = (ImageView) findViewById(R.id.w1);
  
      imageView.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
              Intent intent = new Intent(context, w1.class);
                          startActivity(intent);   
                          Intent intent1 = new Intent(context , w1.class); 
                          intent1.putExtra("fname" , etFName.getText().toString());
                          startActivity(intent1);
  
          }
  
      }); } 
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
      if (id == R.id.action_settings) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and this is segment of code for the button which make a problem when i click on it : </p>
  
  <pre><code> button = (Button) findViewById(R.id.buttonW);
   button.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View arg0) {
  
              Intent intent = new Intent(context, weddingActivity.class);
                          startActivity(intent);   
  
          }
  
      }); } 
  </code></pre>
  
  <p>and this is a logcat </p>
  
  <pre><code>12-06 19:31:11.445: E/dalvikvm-heap(10195): Out of memory on a 30873616-byte allocation.
  12-06 19:31:11.455: E/AndroidRuntime(10195): FATAL EXCEPTION: main
  12-06 19:31:11.455: E/AndroidRuntime(10195): Process: com.example.invitationcard, PID: 10195
  12-06 19:31:11.455: E/AndroidRuntime(10195): java.lang.RuntimeException: Unable to start             activity ComponentInfo{com.example.invitationcard/com.example.invitationcard.weddingActivity}:      android.view.InflateException: Binary XML file line #104: Error inflating class &lt;unknown&gt;
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2237)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.ActivityThread.access$800(ActivityThread.java:144)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.os.Handler.dispatchMessage(Handler.java:102)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.os.Looper.loop(Looper.java:212)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.ActivityThread.main(ActivityThread.java:5135)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at java.lang.reflect.Method.invokeNative(Native Method)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at java.lang.reflect.Method.invoke(Method.java:515)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at dalvik.system.NativeStart.main(Native Method)
  12-06 19:31:11.455: E/AndroidRuntime(10195): Caused by: android.view.InflateException: Binary XML file line #104: Error inflating class &lt;unknown&gt;
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.createView(LayoutInflater.java:620)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at com.example.invitationcard.weddingActivity.onCreate(weddingActivity.java:27)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.Activity.performCreate(Activity.java:5231)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    ... 11 more
  12-06 19:31:11.455: E/AndroidRuntime(10195): Caused by: java.lang.reflect.InvocationTargetException
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at java.lang.reflect.Constructor.constructNative(Native Method)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.view.LayoutInflater.createView(LayoutInflater.java:594)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    ... 25 more
  12-06 19:31:11.455: E/AndroidRuntime(10195): Caused by: java.lang.OutOfMemoryError
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:594)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:429)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:856)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.content.res.Resources.loadDrawable(Resources.java:2129)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.widget.ImageView.&lt;init&gt;(ImageView.java:129)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    at android.widget.ImageView.&lt;init&gt;(ImageView.java:119)
  12-06 19:31:11.455: E/AndroidRuntime(10195):    ... 28 more
  </code></pre>