The reason the class cannot be found is because one of the interfaces implemented by AppListFragment (OnQuerytextListener) is defined in SearchView, which is found only in Honeycomb (API 11 +).
public static class AppListFragment extends ListFragment implements OnQueryTextListener, LoaderManager.LoaderCallbacks<List<AppEntry>> {
I searched in the compatibility bank, but I can not find anything in common with SearchView, so I assume that this will only work on Honeycomb and up (and compiling with a target lower than Honeycomb will prevent this.
There are also several other crashes for the same reason, for example Loader β Throttle, then click on the menu - the missing method.
On the Compatibility Pack page
Warning. Be sure that you are not confusing the standard android packages with the android.support libraries. Some code completion tools may make a mistake, especially if you build against the latest versions of the platform. To be safe, keep the build target the same version as for your android: minSdkVersion and double-check import statements for classes that also exist in the support library, for example SimpleCursorAdapter
Following their own advice, the whole project cannot compile - half of the example classes seem to depend on something more than API 4.
My answer? Some of the examples are bad and rely on code that is not present. In any case, Google will soon update them to work.
Oh yes, you can temporarily make it work by removing OnQueryTextListener and methods from AppListFragment, but later it will work with another problem.
source share