title: how to calculate age from birth date in shared preference
body: <p>Hello everyone i'm developing android app that takes the birth date of a baby in a preference screen so the app can save it. but what i need after retrieving the value is to calculate the age to use it in different activities in the same app so what can i do and is it possible to convert the string(birth date) into int age??</p>
  
  <p>here is the code for pref.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  &lt;EditTextPreference
      android:title="Enter baby name"
      android:key="name"
      android:summary="Enter baby name"
      android:defaultValue="0"
      /&gt;
  
   &lt;EditTextPreference
       android:persistent="true"
       android:key="age"
       android:title="Enter Baby birthday "
       android:summary="baby age"
       /&gt;
   &lt;ListPreference
       android:title="Gender"
       android:key="list"
       android:entries="@array/list"
       /&gt;
  
  
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>and for getting them</p>
  
  <pre><code>SharedPreferences getPref = 
         PreferenceManager.getDefaultSharedPreferences(getBaseContext());
  
  String text = getPref.getString("name", " ");
  
  String age = getPref.getString("age", " ");
  </code></pre>
  
  <p>please help</p>