So, i was trying to save some small data such as username of the user (remember me feature) and sharedpreference doesnt seems to save any data into my android device. i wonder why, and there's nothing wrong with my code...
final Button btnLogin = (Button) findViewById(R.id.btn_Login);
        btnLogin.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                tvName = (EditText) findViewById(R.id.edit_mName);
                tvPassword = (EditText) findViewById(R.id.edit_mPassword);
                try {
                    if (cbRme.isChecked()) {
                        SharedPreferences prefs = getSharedPreferences(
                                PREFS_NAME, Context.MODE_PRIVATE);
                        SharedPreferences.Editor editor = prefs.edit();
                        editor.clear();
                        editor.putString("keyusername", tvName.getText()
                                .toString());
                        editor.putString("keypassword", tvPassword
                                .getText().toString());
                        editor.putBoolean("keycheckbox", true);
                        editor.commit();
                    } else {
                        SharedPreferences prefs = getSharedPreferences(
                                PREFS_NAME, Context.MODE_PRIVATE);
                        SharedPreferences.Editor editor = prefs.edit();
                        editor.clear();
                        editor.remove("keyusername");
                        editor.remove("keypassword");
                        editor.remove("keycheckbox");
                        editor.commit();
                    }
                } catch (Exception e) {
                    Toast.makeText(getBaseContext(), e.getMessage(),
                            Toast.LENGTH_LONG).show();
                }
    public void onResume() {
    SharedPreferences prefs = getSharedPreferences("project", 0);
    username = prefs.getString("keyusername", DEFAULT);
    password = prefs.getString("keypassword", DEFAULT);
    checkbox = prefs.getBoolean("keycheckbox", false);
    if ((username.equals(DEFAULT)) || checkbox == false) {
        Toast.makeText(getBaseContext(), "No data found", Toast.LENGTH_LONG)
                .show();
    } else {
        Toast.makeText(getBaseContext(), "Data is found.",
                Toast.LENGTH_LONG).show();
        setUsername();
        setCheckedBox();
    }
    super.onResume();
}
private void setUsername() {
    EditText tvName = (EditText) findViewById(R.id.edit_mName);
    tvName.setText(username);
}
private void setCheckedBox() {
    cbRme = (CheckBox) findViewById(R.id.cbRememberMe);
    cbRme.setChecked(checkbox);
}
 
    