android error inflating class
<p>I am trying to display a list of checkboxes and have found some code on this site which I am using as a basis.  The xml file is:-</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;PreferenceCategory android:title="Test"&gt;
 &lt;CheckBoxPreference
        android:title="Test"
        android:summary="Testing"
        android:defaultValue="false"
        android:key="pref_connect_launch_enable"
        android:dependency="pref_connect_enable"/&gt;
    &lt;com.MyApp.AppSelectorPreference
        android:title="Select Application"
        android:summary="Select application"
        android:key="pref_connect_package_name"
        android:dependency="pref_connect_launch_enable"/&gt;

&lt;/PreferenceCategory&gt;
&lt;/PreferenceScreen&gt;
</code></pre>

<p>The code for building the list is:-</p>

<pre><code>import java.util.List;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.preference.ListPreference;
import android.util.AttributeSet;


public class AppSelectorPreference extends ListPreference {

    public AppSelectorPreference(Context context, AttributeSet attrs) {
        super(context,attrs);

        PackageManager pm = context.getPackageManager();
        List&lt;PackageInfo&gt; appListInfo = pm.getInstalledPackages(0); 
        CharSequence[] entries = new CharSequence[appListInfo.size()];
        CharSequence[] entryValues = new CharSequence[appListInfo.size()];

        try {
            int i = 0;
            for (PackageInfo p : appListInfo) {
                if (p.applicationInfo.uid &gt; 10000) {
                    entries[i] = p.applicationInfo.loadLabel(pm).toString();
                    entryValues[i] = p.applicationInfo.packageName.toString();              
                    //Log.d(BT,"Label: " + entries[i]);
                    //Log.d(BT,"PName: " + entryValues[i]);
                    i++;
                }         
            }
        } catch (Exception e) {
            //Log.e(BT,"ER&gt; Put descriptive error message here");
            e.printStackTrace();
        }   

        setEntries(entries);
        setEntryValues(entryValues);
    }

    }
</code></pre>

<p>}</p>

<p>and I am calling it as follows:-</p>

<pre><code>AppSelectorPreference appSelector = new AppSelectorPreference(this,null);
setContentView(R.xml.selectPref);
</code></pre>

<p>The code runs but errors with :- </p>

<p>InflaterException Binary XML file line #2: Error inflating class PreferenceScreen</p>

<p>in Logcat  it also shows ClassNotFound exception</p>

<p>I cant see what is wrong with line 2 in the xml file so I hope someone can help.</p>
