title: How to transfer data from one Screen to another in android?
body: <p>I am trying to transfer data from one page to another but some problem is coming. below is the code.its force closing the app after i am pressing the second page button</p>
  
  <p>Here my first program:</p>
  
  <pre><code>package com.life.insurance;
  
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  /*import android.view.Menu;*/
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  
  
  public class LifeInsuranceActivity extends Activity implements OnClickListener{
  /*    private static final int MENU_STARS = 1;
      private static final int MENU_REFRESH = 2;*/
    Context mCtx;
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          Button submit =(Button)findViewById(R.id.button1);
          submit.setOnClickListener(this);
      }
  
  
      @Override
      public void onClick(View v) {
          // TODO Auto-generated method stub
          switch (v.getId()){
          case R.id.button1:
               mCtx = this;
  
               String intext = new String();
               intext=((EditText)findViewById(R.id.editText1)).getText().toString(); 
  
                  Intent myIntent = new Intent(mCtx, MenuSelection.class); 
                  Bundle bundle = new Bundle(1);
                  bundle.putString("ganna", intext);
                  myIntent.putExtras(bundle);
  
                  /*Start Activity*/
                  mCtx.startActivity(myIntent);
  
                  /*Start ActivityForResult*/
                  ((Activity)mCtx).startActivityForResult(myIntent, 2);
  
              setContentView(R.layout.menuselection);
              break;      
          }
      }
  }
  </code></pre>
  
  <p>This is my second Activity</p>
  
  <pre><code>package com.life.insurance;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class MenuSelection  extends Activity implements OnClickListener{
       String ot;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.menuselection);
          Button search =(Button)findViewById(R.id.imageButton1);
          search.setOnClickListener(this);
          Bundle extras = this.getIntent().getExtras();
          ot =extras.getString("ganna").toString();
          final  TextView r =(TextView)findViewById(R.id.txt1);
          r.setText(ot);
  
      }
  
  @Override
  public void onClick(View v) {
      // TODO Auto-generated method stub
      switch (v.getId()){
      case R.id.imageButton1:
  
  
          break;
  
      }
    }
  
  }
  </code></pre>
  
  <p>please help me to do this</p>