title: android unit test: clearing prefs before testing activity
body: <p>I want to ensure that a preference is cleared before my <code>Activity</code> is started in my unit test.</p>
  <p>The problem is that to clear the preferences, you need to call <code>getActivity()</code>.  After that, the <code>Activity</code> is started, which reads the preferences.</p>
  <pre><code>@Override
  protected void setUp() throws Exception {
      super.setUp();
      mActivity = this.getActivity();
      SharedPreferences prefs = 
         PreferenceManager.getDefaultSharedPreferences(mActivity);
      prefs.edit().clear().commit();
  }
  </code></pre>
  <p>When <code>getActivity()</code> is called, the <code>Activity</code> is created, which reads the value of the pref, before the next lines clear the pref.</p>
  <p>Is there a way obtaining a <code>Context</code> object without starting the <code>Activity</code>?</p>
  <p>I'm new to Android unit tests, so maybe I'm missing something basic.</p>