Passing values with condition in intent?
<p>I want to send some data from activity <code>A</code> to activity <code>B</code> ONLY in case I have entered some values in activity <code>A</code>. So, in <code>A</code> I have </p>

<pre><code>Intent i = new Intent(A.this, B.class);
i.putExtra("email", email);
i.putExtra("password", password);
startActivity(i);
</code></pre>

<p>In <code>B</code>: </p>

<pre><code>EditText login = (EditText) findViewById(R.id.login);
EditText password = (EditText) findViewById(R.id.password);
if(!(getIntent().getExtras().getString("email").isEmpty())){
    emailText = getIntent().getExtras().getString("email");
    login.setText(emailText);
    if(!(getIntent().getExtras().getString("password").isEmpty())){
        passwordText = getIntent().getExtras().getString("password");
        password.setText(passwordText);
    } 
}
</code></pre>

<p>But when I run my project, I get "Sorry, the application has stopped unexpectedly..." In LogCat I get a <code>NullPointerException</code>. </p>

<p>What is my mistake? </p>
