Tag: android-viewpager

Send values from ViewPager Activity to a Fragment by bundle

I have an ViewPager Activity that call the fragment that represent the slide layout. What i need is pass values from activity to fragment by bundle. How i can do this? I try pass a int 2 in onCreate() but not work and i Activity: @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_screen_slide); Intent intent = […]

android background image slows down app

I am using a viewpager to swipe amongst fragments in my app. I define the background in the XML, so android:background=”@drawable/bg_final” If I use a simple background color, my app works very smooth. If I use it with this background image, fps decreases and my app becomes only passable. It is not slow, just not […]

Fragments in ViewPager not loaded when the containing Fragment is recreated

I have a Fragment MyFragment vith a ViewPager containing more Fragment. It works properly the first time I load MyFragment, but if I go back and recreate it, the Fragments in the ViewPager are not shown because the method FragmentPagerAdapter.getItem is not called. I’m using What’s wrong? import android.app.Fragment; import android.app.FragmentManager; import android.support.v13.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; […]

android load data asynchronously in view pager

I need a solution for view pager implementation. Firstly I am loading huge data from database in single page,so sometimes during swipe it slows down swipe frequency(you need to multiple time swipe on page) as in background it is doing fetching task. I am not using async task for returning view. Is there any way […]

Contents of Viewpager lost on rotation

I have a project that has a MainActivity which hosts a fragment that hosts two other fragments via a Viewpager. It looks fine on first start up, but when I rotate, the two fragments in the Viewpager are lost. I’ve tried changing getFragmentManager to getChildFragmentManager but I would then get a Illegal state exception: Can’t […]

My fragments in viewpager tab dont refresh

i got viewpager with 4 tabs .. in each tab there is a fragment. my first tab is a fragment with a form (for example Users) after i click save, the data is inserted in the database. my second tab is another fragment with form but it uses data from the first tab (i am […]

Why is my fragment onCreate being called extensively whenever I page through my applications viewPager?

I’m not quite understanding this fragment lifecycle business. I have a pretty standard 3 page horizontal slider view Pager layout for a “view details” section of my app. I start my app on the middle page of the three. My FragmentActivity sets the page to page 1. mPager.setCurrentItem(1); //default to center page, current data view […]

Change viewpager fragment by a buttonClick

I’m trying to change the viewpager fragment by clicking on a button. I have 5 fragments, each fragment has it’s own xml file (frag1.xml, frag2.xml, and so on). Every fragment has it’s 5 buttons that should go to other pages of the viewpager. But the problem is how do I check in the FragmentPageAdapter which […]

Set Viewpager height inside Scrollview in android

I have to show a viewpager (An image and text below the image in pager row) inside a scrollview. I’m downloading the image, text from web and showing in pager rows. I wrapped viewpager inside a srollview to support the landscape mode too. <com.xxx.myapp.android.ui.CustomScrollView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_gravity=”center” android:fadingEdge=”none” android:fillViewport=”true” android:gravity=”center”> <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:descendantFocusability=”blocksDescendants” android:orientation=”vertical” […]

ViewPager doesn't always refresh when setAdapter is called, FragmentStatePagerAdapter

First of all, I am using FragmentStatePagerAdapter to feed a ViewPager with fragments to display. When app is in the running state (i.e. after onResume()), calling setAdapter on the ViewPager will always work and make my ViewPager refresh, the getItem(int position) method in the adapter is called. However after an orientation change, if I call […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.