title: How to use putExtra() and getExtra() for string data
body: <p>Can someone please tell me how exactly to use <code>getExtra()</code> and <code>putExtra()</code> for intents? Actually I have a string variable, say str, which stores some string data. Now, I want to send this data from one activity to another activity. </p>
  
  <pre><code>  Intent i = new Intent(FirstScreen.this, SecondScreen.class);   
    String keyIdentifer  = null;
    i.putExtra(strName, keyIdentifer );
  </code></pre>
  
  <p>and then in the SecondScreen.java</p>
  
  <pre><code> public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.table);
          TextView userName = (TextView)findViewById(R.id.userName);
          Bundle bundle = getIntent().getExtras();
  
          if(bundle.getString("strName")!= null)
          {
              //TODO here get the string stored in the string variable and do 
              // setText() on userName 
          }
  
      }
  </code></pre>
  
  <p>I know it is very basic question but unfortunately I am stuck here. 
  Please help.</p>
  
  <p>Thanks,</p>
  
  <p>Edit: Here the string which I am trying to pass from one screen to the other is dynamic.
  That is I have an editText where I am getting string whatever user types. Then with the help of <code>myEditText.getText().toString()</code> . I am getting the entered value as a string then I have to pass this data.</p>