I have used SharedPreferences to save some details in the Main Activity .Now i want to get the details in some other activity but i am not able to get them .

**Code to save**

```
public void saveInformation(String username,String password) {
        SharedPreferences shared = getSharedPreferences("shared", MODE_PRIVATE);
        SharedPreferences.Editor editor = shared.edit();
        editor.putString("username", username);
        editor.putString("password", password);
        editor.commit();
    }

```

**Code to get**

```
SharedPreferences prefs = getPreferences(MODE_PRIVATE); 
String username = prefs.getString("username", null);

```

But this is not working for me . How could I get his?