Passing data through Intents
<p>I always get a <code>java.lang.NullPointerException</code> when retrieve the data from my <code>MainActivity</code> to my second <code>Activity</code>.</p>

<p>This from my <code>MainActivity</code>:</p>

<pre><code>Intent i = new Intent(MainActivity.this,ScanActivity.class);
i.putExtra("isConnected", String.valueOf(isConnected));
i.putExtra("serverIP", serverIP);
startActivity(i);
</code></pre>

<p>And here's where I get the <code>NullPointerException</code>:</p>

<pre><code>Intent extras = getIntent();
public String isConnected = extras.getStringExtra("isConnected");
public String serverIP = extras.getStringExtra("serverIP");
</code></pre>

<p>Is my code wrong or is there something else that causes it to be <code>null</code>?</p>