title: How to call custom preference
body: <p>Hi I'm trying to call a custom preference. Why does the application crash?</p>
  
  <p>When I set up the custom preference in preference.xml, the application breaks at "com.appdev.customprefs.SeekBarPreference". I want it to use SeekBarPreference.java and I thought I needed to include the package.SeekBarPreference to get it to work.</p>
  
  <p>xml/preferences.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;com.appdev.customprefs.SeekBarPreference
          android:title="Custom Preference"
          android:key="customPref"
          android:defaultValue="32""/&gt;
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>stacktrace</p>
  
  <blockquote>
    <p>11-17 20:02:17.920: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:18.100: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:18.100: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.080: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.080: I/Choreographer(1482): Skipped 41 frames!  The application may be doing too much work on its main thread.
    11-17 20:02:19.080: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.110: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.130: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.271: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.271: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.290: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.340: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.360: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.360: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.360: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.360: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.360: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.380: D/gralloc_goldfish(1482): Emulator without GPU emulation detected.
    11-17 20:02:19.530: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:19.580: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:21.980: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:21.980: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.011: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.020: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.080: D/dalvikvm(1482): GC_FOR_ALLOC freed 115K, 9% free 2602K/2836K, paused 39ms, total 42ms
    11-17 20:02:22.090: I/dalvikvm-heap(1482): Grow heap (frag case) to 3.259MB for 635812-byte allocation
    11-17 20:02:22.200: D/dalvikvm(1482): GC_FOR_ALLOC freed 3K, 7% free 3220K/3460K, paused 120ms, total 120ms
    11-17 20:02:22.470: D/dalvikvm(1482): GC_CONCURRENT freed &lt;1K, 7% free 3239K/3460K, paused 81ms+130ms, total 266ms
    11-17 20:02:22.521: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.530: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.580: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.710: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.760: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.760: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.790: I/Choreographer(1482): Skipped 67 frames!  The application may be doing too much work on its main thread.
    11-17 20:02:22.790: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.790: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.810: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.860: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.870: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.910: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.960: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:22.960: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.010: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.020: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.080: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.160: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.852: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.852: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.890: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.890: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.920: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.920: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.970: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.970: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.970: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:23.970: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.010: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.010: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.030: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.030: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.050: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.050: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.142: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.142: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.180: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.180: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.554: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.572: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.650: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.650: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.650: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.650: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.670: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.670: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.810: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.810: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.820: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.820: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.820: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.880: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:24.940: W/Trace(1482): Unexpected value from nativeGetEnabledTags: 0
    11-17 20:02:25.410: D/AndroidRuntime(1482): Shutting down VM
    11-17 20:02:25.410: W/dalvikvm(1482): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
    11-17 20:02:25.540: E/AndroidRuntime(1482): FATAL EXCEPTION: main
    11-17 20:02:25.540: E/AndroidRuntime(1482): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appdev.customprefs/com.appdev.customprefs.preferences}: android.view.InflateException: Binary XML file line #4: Error inflating class com.appdev.customprefs.SeekBarPreference
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.os.Handler.dispatchMessage(Handler.java:99)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.os.Looper.loop(Looper.java:137)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.ActivityThread.main(ActivityThread.java:5039)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at java.lang.reflect.Method.invokeNative(Native Method)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at java.lang.reflect.Method.invoke(Method.java:511)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at dalvik.system.NativeStart.main(Native Method)
    11-17 20:02:25.540: E/AndroidRuntime(1482): Caused by: android.view.InflateException: Binary XML file line #4: Error inflating class com.appdev.customprefs.SeekBarPreference
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.createItem(GenericInflater.java:386)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:430)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.rInflate(GenericInflater.java:493)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.inflate(GenericInflater.java:326)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.inflate(GenericInflater.java:263)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.PreferenceActivity.addPreferencesFromResource(PreferenceActivity.java:1424)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at com.appdev.customprefs.preferences.onCreate(preferences.java:12)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.Activity.performCreate(Activity.java:5104)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     ... 11 more
    11-17 20:02:25.540: E/AndroidRuntime(1482): Caused by: java.lang.NoSuchMethodException:  [class android.content.Context, interface android.util.AttributeSet]
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at java.lang.Class.getConstructorOrMethod(Class.java:460)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at java.lang.Class.getConstructor(Class.java:431)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     at android.preference.GenericInflater.createItem(GenericInflater.java:377)
    11-17 20:02:25.540: E/AndroidRuntime(1482):     ... 22 more
    11-17 20:02:28.760: I/Process(1482): Sending signal. PID: 1482 SIG: 9</p>
  </blockquote>
  
  <p>SeekBarPreference.java</p>
  
  <pre><code>public class SeekBarPreference extends Preference implements OnSeekBarChangeListener
  {
  
  public SeekBarPreference(Context context)
  {   
      super(context);
      Log.i("SBP", "In SBP!");
  }
  
  @Override
  public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void onStartTrackingTouch(SeekBar arg0) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void onStopTrackingTouch(SeekBar arg0) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  protected View onCreateView(ViewGroup parent) {
      Log.i("SBP", "In SBP2!");
      return super.onCreateView(parent);
  }
  
  }
  </code></pre>