title: How to use Content Resolver passed into a static method as an argument
body: <p>Very sorry if I've missed a solution that is along these lines.  I am a question asking noob here, but have visited many times for research, and I did search, I promise.</p>
  
  <p>I'm trying to add a method to use upon a reboot to restore a kernel node which controls the activation/deactivation of hardware capacitive keys on an affected Android device.  I've created a method to do this inside of my HardwareKeysSettings.java class:</p>
  
  <pre><code>public static void restore(Context context) {
          boolean enableHardwareKeys = Settings.System.getInt(getContentResolver(),
                  Settings.System.HARDWARE_KEYS_ENABLED, 1) == 1;
          Settings.System.putInt(getContentResolver(),
              Settings.System.HARDWARE_KEYS_ENABLED, enableHardwareKeys ? 1 : 0);
  }
  </code></pre>
  
  <p>And my method is called from a BootReceiver class:</p>
  
  <pre><code>    package com.android.settings.slim;
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  
  import com.android.settings.slim.HardwareKeysSettings;
  
  public class BootReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context ctx, Intent intent) {
          /* Restore the hardware tunable values */
          HardwareKeysSettings.restore(ctx);
      }
  }
  </code></pre>
  
  <p>I can't compile this, because in my restore() method above, the getContentResolver() method can't be used within a static method (which I need to use).  I get these errors:</p>
  
  <pre><code>/packages/apps/Settings/src/com/android/settings/slim/HardwareKeysSettings.java:676: Cannot make a static reference to the non-static method getContentResolver() from the type SettingsPreferenceFragment
  
  /packages/apps/Settings/src/com/android/settings/slim/HardwareKeysSettings.java:678: Cannot make a static reference to the non-static method getContentResolver() from the type SettingsPreferenceFragment
  </code></pre>
  
  <p>Not surprising or terribly abnormal issues there.  Speaking with someone who is way more knowledgeable about this than me, I was only given this hint... to </p>
  
  <blockquote>
    <p>"call your content resolver from the context passed as a arg"</p>
  </blockquote>
  
  <p>which makes sense to me since obviously the getContentResolver() method is non-static and can't be used inside my static method.  I need to pass in something in order to use the getContentResolver() method properly.</p>
  
  <p>So, the question is, how exactly do I do this?  I've got somewhat of an idea, but ContentResolver is among the most confusing of Android/java things to me.  </p>
  
  <p>I'm kind of thinking this means passing in ContentResolver like this, but no clue how to use it internally for my purpose:</p>
  
  <pre><code>public static void restore(Context context, ContentResolver contentResolver) {
  </code></pre>
  
  <p>Thanks in advance... :)</p>