SharedPreferences to save user profile
<p>I'm new to SharedPreferences. I'd like to save user profile using sharedpreferences, and the second time the user goes to profile activity, he should see the details he filled in before. How am I able to do that? Can you please give me some code to do that?</p>

<p>Here's what I have tried but I don't know what to put inside if else statements:</p>

<pre><code>import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;

public class A extends Activity
{
   private static final String MY_KEY = "myprefs";
   private SharedPreferences myPrefs;
   private boolean loggedIn;

  protected void onCreate(Bundle savedInstanceState) 
  {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.iprofile);

   myPrefs = getSharedPreferences(MY_KEY, MODE_PRIVATE);

   loggedIn = myPrefs.getBoolean("loggedIn", false);  //default to false if the value has not been set

   if(loggedIn)
   {
      //do stuff

   }
  else
   {
       //do other stuff
    }
}
}
</code></pre>

<p>this is my xml file: <a href="http://pastebin.com/gXCHpk0E" rel="nofollow">http://pastebin.com/gXCHpk0E</a> and my java class: <a href="http://pastebin.com/NZJ0CR8H" rel="nofollow">http://pastebin.com/NZJ0CR8H</a></p>
