title: Sharedpreferences in android studio
body: <p>I've been starting to develop a pretty basic app but I cant use sharedpreference for some reason. The app crashes when it should be saved.</p>
  
  <p>this is my code:</p>
  
  <pre><code>SharedPreferences sp=getSharedPreferences("details1",0);
      SharedPreferences.Editor editor=sp.edit();
      editor.putString("etName",etName.getText().toString());
      editor.putString("etLName",etLName.getText().toString());
      editor.putString("etCity",etCity.getText().toString());
      editor.putString("btnDateOfBirth",btnDateOfBirth.getText().toString());
      editor.putString("btnGender",btnGender.getText().toString());
      editor.commit();
  </code></pre>
  
  <p>I've declared on the variables needed. What might cause it to crash ?</p>