How to pass data between two activities in android?
<p>How to pass data between two activities in android?</p>

<p>Following is my code:-</p>

<pre><code>Intent intent = new Intent(getBaseContext(), SignoutActivity.class);
intent.putExtra("EXTRA_SESSION_ID", sessionId);
startActivity(intent)
</code></pre>

<p>Second I used SharedPreferences for that:-</p>

<p>For Pass Data:-</p>

<pre><code> SharedPreferences gameSettings = getSharedPreferences("MyGamePreferences",MODE_PRIVATE);  
 SharedPreferences.Editor prefEditor = gameSettings.edit();  
 prefEditor.putString("UserName", "Guest123");  
 prefEditor.putBoolean("PaidUser", false);  
 prefEditor.commit();
</code></pre>

<p>For Getting Data in next Activity:-</p>

<pre><code>SharedPreferences gameSettings = PreferenceManager
                                .getDefaultSharedPreferences(getBaseContext());
String s= gameSettings.getString("UserName", "Dipak");
Boolean b= gameSettings.getBoolean("PaidUser", true);
</code></pre>

<p>but data is not getting in next activity.</p>
