Cannot open XML files in Graphical Layout: FakeAdapter cannot be cast to BaseAdapter

I'm having some problems with my android project in eclipse.

I have two XML layout files, and both contain ListViews.

The ListViews are working perfectly on my Android phone, but eclipse wont open the design window, giving the following error:

com.android.layoutlib.bridge.impl.binding.FakeAdapter cannot be cast to android.widget.BaseAdapter

Both files contains the following code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<ListView
    android:id="@+id/cardList"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fadeScrollbars="true"
    android:fastScrollAlwaysVisible="true"
    android:fastScrollEnabled="true"
    android:scrollbarSize="30dp"
    android:scrollbarStyle="insideOverlay" >
</ListView>

</LinearLayout>

Any suggestions?

Answers


It might be the

android:fastScrollAlwaysVisible="true"

that is bugging your application. Try deleting it.


Just change device in layout preview.

Small screens (inches < 7) cannot preview properly. Select 10.1'' for example.


I don't have any android:fastScroll* option in any of my layouts, however I do receive this error on any version of Android, but can't reproduce on any test devices.

Turns out this occurs when I attach an Adapter declared like this:

MyAdapter implements ListAdapter

Changing to the following actually fixes the issue:

MyAdapter extends BaseAdapter

EDIT: Turns out users where using an Xposed module to forst fastscroll on app ListView's! Unfortunately that module is pretty dumb and doesn't check the adapter type.


Need Your Help

xCode draw - Trying to maintain color choice in CGRect

xcode core-graphics cgrect

I have a simple drawing class. There is a view controller that includes a color selection bar. Then a UIView that has the CGRect draw functions.

No indexes on small tables?

sql sql-server indexing performance

"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." (Donald Knuth). My SQL tables are unlikely to contain more than a few thousan...