title: How to get object type of preference in Android?
body: <p>I can get a <code>String</code> from the shared preferences by using:</p>
  
  <pre><code>sharedPreferences.getString("key_name","default value");
  </code></pre>
  
  <p>But how can I check if <code>key_name</code> is actually a <code>String</code>?</p>
  
  <p>What if it is a Boolean key value?</p>
  
  <p>Is there a method we can use like:</p>
  
  <pre><code>if(sharedPreferences.isTypeOf(Boolean,"key_name")) {}
  </code></pre>