title: Transfer data between EditText and Text View
body: <p>I'm trying to make an activity that take the value of the EditText and put it in the TextView in another activity.</p>
  
  <p>This is the code for the first activity which contains a Textview and option menu to edit it </p>
  
  <pre><code>public class Saturday extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.saturday);
  
      Intent i = getIntent();
      String txt = i.getExtras().getString("txtData","");
      final TextView Tclass1;
      Tclass1 = (TextView)findViewById(R.id.seven);
      Tclass1.setText(txt);
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.saturday, menu);
      return true;
  }
  @Override
  public boolean onOptionsItemSelected(MenuItem item)
  {
   switch(item.getItemId())
   {
   case R.menu.saturday:
       edit_schedule();
    return true;
   }
   return super.onOptionsItemSelected(item);
  
  }
  public void edit_schedule() {
      final TextView Tclass1;
      Tclass1 = (TextView)findViewById(R.id.seven); 
      Intent i = new Intent(this, EditSaturday.class);
   i.putExtra("text" , Tclass1.getText().toString());
   startActivity(i);
  
  }}
  </code></pre>
  
  <p>This is the code for the other activity which contains an EditText with the save button</p>
  
  <pre><code>public class EditSaturday extends Activity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.edit_saturday);
  
      Intent i = getIntent();
      String txt = i.getExtras().getString("txtData","");
      final EditText Eclass1;
      Eclass1 = (EditText)findViewById(R.id.eseven);
      Eclass1.setText(txt);
  
      findViewById(R.id.save).setOnClickListener(new View.OnClickListener() { 
          @Override
          public void onClick(View v) {
  
              save();
              }});
  
  }
  
  public void save() {
      final EditText Eclass1;
      Eclass1 = (EditText)findViewById(R.id.eseven);
      Intent i = new Intent(this, Saturday.class);
       i.putExtra("text" , Eclass1.getText().toString());
   startActivity(i);
  
  }}
  </code></pre>
  
  <p>After I run the application it give me an error</p>
  
  <p>this is the logCat</p>
  
  <pre><code>04-14 08:15:17.911: E/AndroidRuntime(1202): FATAL EXCEPTION: main
  04-14 08:15:17.911: E/AndroidRuntime(1202): java.lang.RuntimeException: Unable to start activity ComponentInfo{sarah.bodoor.sto/sarah.bodoor.sto.Saturday}: java.lang.NullPointerException
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.os.Handler.dispatchMessage(Handler.java:99)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.os.Looper.loop(Looper.java:137)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at java.lang.reflect.Method.invokeNative(Native Method)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at java.lang.reflect.Method.invoke(Method.java:511)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at dalvik.system.NativeStart.main(Native Method)
  04-14 08:15:17.911: E/AndroidRuntime(1202): Caused by: java.lang.NullPointerException
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at sarah.bodoor.sto.Saturday.onCreate(Saturday.java:22)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.Activity.performCreate(Activity.java:5104)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  04-14 08:15:17.911: E/AndroidRuntime(1202):     ... 11 more
  </code></pre>