Tuesday, 27 August 2013

Execute onCreate of activity of layout included in ViewFlipper

Execute onCreate of activity of layout included in ViewFlipper

I'm trying to use ViewFlipperin my app but I'm having some problems.
What I want is:
After login (first view), go to ViewFlipper, where I have included two
layouts. The first one, which I want to show, is a
SherlockFragmentActivitywith FragmentPagerAdapter. Without ViewFlipperit
is running ok.
The problem is:
How can I call onCreate method of my SherlockFragmentActivity? As it is
not called, it's not showing anything.
Code:
view_flipper.xml
<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<include
android:id="@+id/first"
layout="@layout/fragment_pager" />
<include
android:id="@+id/second"
layout="@layout/activity_factura" />
</ViewFlipper>
FlipperActivity.java
public class FlipperActivity extends SherlockActivity {
ViewFlipper flipper;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_flipper);
}
}
fragment_pager.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".TabsFacturasActivity" >
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#1184A4E8" />
</LinearLayout>

No comments:

Post a Comment