title: Passing data from one activity to another and then printing
body: <p>The problem I am having is that it prints out Null on the second activity and not the actual username that is entered. Is the data being passed to the second activity correctly? Does the second activity need more code? Sorry but not the best at programming.</p>
  
  <p>I have this code in my main class</p>
  
  <pre><code>if (username.getText().toString().equals("batman") &amp;&amp;
  password.getText().toString().equals("Joker")) { 
  Toast.makeText(MainActivity.this, "Username and 
  password is correct", Toast.LENGTH_SHORT).show();
  Intent intent = new Intent("com.example.*******.loginpage.User");
  intent.putExtra("username",String.valueOf(username));
  startActivity(new Intent(MainActivity.this, User.class));
  </code></pre>
  
  <p>This is the code inside my second class.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_user);
  
  Intent intent = getIntent();
  String username = getIntent().getStringExtra("username");
  
  TextView textView = (TextView) findViewById(R.id.textView4);
  textView.setText("Welcome" + " " + username );
  </code></pre>