Using custom Preference views
<p>I have a wallpaper in the market, want to add a setting for color preference. After days and days I can't get the color preference to work.</p>

<p>The test environment I am using is the standard Cube2Settings wallpaper app. I have copied across the code from <a href="https://github.com/commonsguy/cwac-colormixer" rel="nofollow">https://github.com/commonsguy/cwac-colormixer</a> which supplies a color selector as a Preference activity.</p>

<p>Specifically, I now have a class called "com.example.android.livecubes.cube2.ColorPreference" (and some others which it needs). In Java, the Intellisense can see this class in my Preference activity. The first lines of ColorPreference.java is:</p>

<pre><code>public class ColorPreference extends DialogPreference {
</code></pre>

<p>My cube2settings.xml looks as follows:</p>

<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/cube2_settings"
        android:key="cube2wallpaper_settings"&gt;

  &lt;ListPreference
        android:key="cube2_shape"
        android:title="@string/cube2_settings_title"
        android:summary="@string/cube2_settings_summary"
        android:entries="@array/cube2_shapenames"
        android:entryValues="@array/cube2_shapeprefix" /&gt;

 &lt;com.example.android.livecubes.cube2.ColorPreference
        android:key="favoriteColor"
        android:defaultValue="0xFFA4C639"
        android:title="Your Favorite Color"
        android:summary="Blue.  No yel-  Auuuuuuuugh!" /&gt;            
&lt;/PreferenceScreen&gt;
</code></pre>

<p>Without the com.example...ColorPreference in the above xml, runs fine. With it, I get "the application process.com.example.android.livecubes has stopped unexpectantly". I don't do anything else with the ColorPrefernce at all in my code, and it compiles just fine. The xml above was copied from the example they provided, just with the class name changed.</p>

<p>It worries me that I can apparently type whatever I like instead of "com.example.android.livecubes.cube2.ColorPreference", and it will compile. Which makes me think this line is at fault, though of course I have tried a billion variations. Isn't there some way that you can limit/check the class name to valid classes in the Eclipse xml editor, like you can in the Java editor, or at least check it is valid without running it in the emulator? I have had this type of problem many times before.</p>

<p>Can anybody help with the specific problem of why the ColorPreference doesn't work, or the general one of getting class names correct in the xml?</p>

<p>Thanks</p>

<p>Peter Webb</p>
