NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference
<p>I have one activity calling another. But it keeps giving me the error "java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.Bundle.getString(java.lang.String)' on a null object reference".</p>

<p>Calling activity:</p>

<pre><code>Intent intent1 = new Intent (this, buisnessProfileEdit.class);
Bundle data1 = new Bundle();
data1.putString("Restaurant Username",restaurantUsername);
startActivity(intent1);
</code></pre>

<p>Called activity: </p>

<pre><code>Intent intentReceived = getIntent();      
Bundle data = intentReceived.getExtras();
restaurantUsername = data.getString("Restaurant Username");
</code></pre>

<p>Can someone help me out why this is happening?</p>