I am using the following code to store data in shared pref.
However when ever this code is called , the virtual device tells me that the application
stopped responding. Any suggestions why this is happening ?
SharedPreferences spref = this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = spref.edit();
editor.putString("td", "SharedPref"); //name-value pair
editor.commit();
Edit:
Now I am using the following
SharedPreferences spref = this.getSharedPreferences(“myPrefs”, MODE_WORLD_READABLE);
SharedPreferences.Editor editor = spref.edit();
editor.putString(“td”, “SharedPref”);
editor.commit();
But I am still Getting “The application has stopped unexpectedly..Please Try Again”
Looks like there was some problem with the virtual device. After recreating it my app started working fine.
In my apps i prefer using my own location names. Declare
then in the code
shouldn’t be any problems with this if the info you’re saving is correct
EDIT
you also need to update your manifest with the following: