I saved a SharedPreferences value in one class now i want to access the value form different java class.I have used below code to save value
public void Savetz(String value){
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(TIMEZONE, value);
editor.commit();
}
public String Loadtz(){
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String tz=sharedPreferences.getString(TIMEZONE, "");
return tz;
}
I have tried by calling Loadtz() from another class by object but it shows "unfortunately app stopped working message ".how can i do this .please give any clue