Tag: android-viewpager

ViewPager Title doesn't appear until I swipe it

I am learning to use ViewPager and PagerTabStrip to implement navigation bar. I have implemented it, my problem is: every time I open the app fresh, the titles don’t show, but after I swipe it once, the titles all appear again, and then everything is normal. code shown below: Customised Adapter public class MyPagerAdapter extends […]

Android – Fragment screen rotate

This question already has an answer here: ViewPager and fragments — what's the right way to store fragment's state? 10 answers

Viewpager in fragment is not shown(restored) when go back from other fragment

I’m facing the problem as following: In main screen, I have 3 buttons: Config, Main, Setting. When each button is clicked, a corresponding fragment will be shown to inflate layout in a FrameLayout. When user is in Config or Setting Fragment, it is able to go back to main Fragment using onBackpressed or click on […]

Android View onSaveInstanceState not called

I am working with CustomView which extends some Android view like FrameLayout. In my layout I use a ViewPager with a custom PagerAdapter. The problem is that my View did not restore it’s state when the fragment is re-attached to the ViewPager/Activity. For example, I have three fragments, if I swipe to the last one […]

Cannot cast to custom ViewPager class

I’m using this source from Chrisbanes Github: https://github.com/chrisbanes/PhotoView and tried making ViewPager with LinearLayout but it’s getting error when casting ViewPager to HackyViewPager Here’s my xml (bacaan.xml): <?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” android:gravity=”center_vertical” > <android.support.v4.view.ViewPager android:id=”@+id/pager” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_weight=”7″ /> <LinearLayout android:layout_width=”match_parent” android:layout_height=”0dip” android:layout_weight=”1″ android:orientation=”horizontal” > … </LinearLayout> </LinearLayout> on the ViewPagerActivity.java […]

Android Actionbar Sherlock with Tabs

I am trying to implement ActionBar Sherlock with Tabs below that as shown in the above wire-frame. Should i use TabActivity ? – since i saw that it is deprecated. Which is the best way to achieve the same.

Outofmemeoryerror (viewpager + imageviews)

i am showing 150+ images in viewpager, when page size crossed 70 app is crashing , all images are loading from network , and i have fallowed [link]: Strange out of memory issue while loading an image to a Bitmap object and i am recycling it whenever page swiping reaches 4, for 70 page app […]

ViewPager inside ScrollView – vertical scroll doesn't work

So, I have this ScrollView with one child – a LinearLayout that has two children: a TextView and a ViewPager. ViewPager contains layout with many elements, that’s why i need the ability to scroll vertically. Only pages in ViewPager may be scrolled horizontally (that is: I’d like to swipe horizontally only within the ViewPager). That […]

How to find the “last page” in a view pager. Or the total 'number' of views. Android Development

Thank you for your help in advanced. And sorry if this is a very silly question, but I cannot find it elsewhere. What I want, is basically, to determine the total amount of pages I have in my ViewPager when it is all set up, like in my code. I have tried (on a later […]

How can I detect a click in an onTouch listener?

I have a ViewPager inside a ScrollView. I need to be able to scroll horizontally as well as vertically. In order to achieve this had to disable the vertical scrolling whenever my ViewPager is touched (v.getParent().requestDisallowInterceptTouchEvent(true);), so that it can be scrolled horizontally. But at the same time I need to be able to click […]

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