I am trying to create an application based on the new ViewPager from the compability library. When I copy the lines from the sample application:
setContentView(R.layout.main);
MyAdapter mAdapter = new MyAdapter(getSupportFragmentManager(), this);
ViewPager mPager = (ViewPager) findViewById(R.id.view_pager);
mPager.setAdapter(mAdapter);
with the following main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/view_pager"
/>
<LinearLayout>
I get a
java.lang.ClassCastException: android.support.v4.app.NoSaveStateFrameLayout
at the line where I cast to ViewPager. Does anyone have an idea why this is happening?