I strucked in storing and getting shared preferences.When a user has been registered if that registration is success then that values has to be stored in his profile nothing but
You've used SharedPreferences.Editor for storing value and then inside another Activity you're using PreferenceManager to retrieve the value. That's why you're getting default value always.
PreferenceManager is used for storing Preferences for a particular app. They are used for storing app settings where as SharedPreferences are used for saving data or values for working inside the app. They cannot be used for app settings. These are two separate files, though both use the Preferences class.
You need to use SharedPreferences object the retrieve the value in place of PreferenceManager. you've already created a SharedPreferences object named "preferences" inside your AnotherActivity
. Just use this SharedPreferences object to retrieve the data you want to as shown below:
String value = preferences.getString("key", def_value);