When I tried to use getSharedPreferences(), eclipse gave me the android.Preference.preference.getSharePreferences() one, but not the one from contextWrapper which has 2 arguements. I tried to included the whole name which is android.content.ContextWrapper.getSharedPreferences(null, 0), but still doesn't work, eclipse said cannot make a static reference to a non static one. Any idea? I don't have any problem calling the one with 2 arguments in other class such as activity though.
public class DialogExPreference extends DialogPreference implements DialogInterface.OnClickListener
{
SharedPreferences settings;
@Override
public void onClick(DialogInterface dialog, int which)
{
if(which==-1)
{
if(!pw1.getText().toString().equals("")&&!pw2.getText().toString().equals(""))
{
if(pw1.getText().toString().equals(pw2.getText().toString()))
{
settings =getSharedPreferences();// android.content.ContextWrapper.getSharedPreferences(null, 0);
Editor editor = settings.edit();
editor.putString("password", pw1.getText().toString());
editor.commit();
Toast.makeText(getContext(), "Password Saved", Toast.LENGTH_SHORT).show();
.....