FAQ Database Discussion Community


How to develop a step number showing Viewpager Indicator in android?

android,android-viewpager,viewpagerindicator
I want to develop a step number ViewPager Indicator in android. When the user is on the first step the indicator will look like this. And when he is on the last step, it should look like this. So, as I go forward in the ViewPager, I want the step...

ViewPager show next and before item preview current page

android,android-viewpager,pager
I want to show viewpager next and before page preview in screen. Before and next page show deep in screen and slide next page with deep animation. You can look this image How can i do it? ...

How to Pass JSON Array using JSON Object

android,json,android-intent,android-viewpager,android-gridview
GridView contains Categories, and when I do tap on any of the GridView item (i.e - any Category) i would like to show items those belongs to that particular Category only in ViewPager. For example, I have two categories first - Electronics and second - Appliances, still whenever i do...

Horizontal ViewPager with vertical gallery in Android

android,android-viewpager,gallery
I have catalog of products with IDs 1...n and each product have 5 different variations: a, b, c, d, e (images). I'm looking for a way how implement it. For switching between product good idea is ViewPager - horizontal, but how to implement variations - vertical? Both ViewPager and variations...

Listview adapter in a ViewPager in a fragment - How to get the Activity

listview,xamarin,android-viewpager,monodroid
I'm trying to build a music browser/player of the local files on the devices using a CursorLoader. I'm using Xamarin android, c#. I'm using a ViewPager which is within a Fragment (not FragmentActivity, since the fragment is part of a Navigation Drawer). I'm having trouble with the listView.Adapter which is...

Finding MyPagerAdapter object name in Android, how?

android,android-viewpager
I have a viewpager with a few fragments. The pageradapter is instantiated in FormActivity as so; //initialise pager for swipe screens ViewPager pager = (ViewPager) findViewById(R.id.viewPager); MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); However, I then need to access MyPagerAdapter.getRegisteredFragment(), but I do not know what the object name for the...

Fragment in viewpager savedinstancestate is always null

android,android-fragments,android-viewpager,android-bundle
I know this question has been asked before but none of the answers given so far is of any help to me. I have a viewpager which is populated with fragments (android.support.v4.app.Fragment) from a FragmentStatePagerAdapter . Some of these fragments contain logic that needs to be retained when the orientation...

ViewPager for Screen Slides without swipe

android,android-viewpager,screen,slide
I want to use a Screen slide but without swipe. I see this example: http://developer.android.com/training/animation/screen-slide.html , only i want slide pages with the top menu and not with the swipe. How I can do it? Thanks....

tabhost along with tabs goes when navigation drawer pulled

android,android-viewpager,android-tabhost,navigation-drawer
I have a navigation drawer with swipe views and tab navigation. My problem is that when navigation drawer is pulled tabs are gone and when i swipe project stops unexpectedly. Below is the logcat here is where studio points the error. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) {...

Scroll more than one item in ViewPager

android,android-viewpager,carousel
I am trying to scroll more than one item in a ViewPager per swipe. I have implemented a carousel like ViewPager by setting the PagerAdapter's getPageWidth() to return .33f. And I am trying to scroll 3 items per swipe. I have tried incrementing position in ViewPager.onPageScrolled(). But it isn't working....

Android ViewPager update list adapter from a different tabbed fragment

android,android-viewpager
I have a View pager Fragment called SalesPartsFragmentHolder which has two child tabbed fragments SalesPartsFragment SelectedSalesPartsFragment Both of these contains Lists with an adapter. What I want to happen is when an item is clicked on SalesPartsFragment, it is added to SelectedSalesPartsFragment. So, when a user moves to the other...

Fragment interaction listeners in FragmentPagers

android,android-fragments,android-activity,android-viewpager,fragmentpageradapter
I am creating a tabbed application using a FragmentPagerAdapter and android.support.v4.view.ViewPager. In order to follow best practices and separation of concerns I have separated my app into several different fragments. Each of the fragments has an interaction listener that requires an Activity to subscribe to. Since I only have one...

Testing ViewPager with Espresso. How perfom action to a button of an Item?

android,android-viewpager,android-espresso,ui-testing
I have a ViewPager whith items containing only a picture and a button. I can't success to interact with the UI of an item (Page) because, excepted the displayed picture, there is nothing to differentiate (from UI point of view) all items of the ViewPager. I tried to select only...

Reset all Views in fragment

android,android-fragments,android-viewpager,android-view
So I am currently in FragmentA.java, a class which consists of different EditTexts and Checkboxes for users to press and input. My question is, I have this reset button, how can I reset the entire fragment view? (e.g. an EditText will be set to empty string, or with the value...

How to add swipelayout in recyclerview inside viewpager fragment?

android,android-viewpager,recyclerview,swipeview
I'm using AndroidSwipeLayout for 'Swipe To Delete' Action in RecyclerView Item. Swipe is not working as parent of RecyclerView is ViewPager Fragment. SwipeLayout also contain parent.requestDisallowInterceptTouchEvent(true); to intercept touchEvent from parent. What is the solution for this without disabling ViewPager swipe.

Enabling zoom on viewpager using Universal Image Loader?

android,android-activity,android-viewpager,universal-image-loader
I have developed a gallery app in android.I am fetching the images form server & displaying on the viewpager.I have used universal image loader for this purpose.My viewpager works fine.But now i want to add the zoom feature such as zoomin/zoom out/pinch zoom.So for purpose i have replaced the image...

Tabs on a single page

android,xml,android-viewpager,android-tabs
I'm currently using a ViewPager with a PagerTabStrip to display 4 tabs at the top of the device. All I want to do is have 4 tabs fixed in place and centered, but I can't figure out how to do that now that the old way (using Action bar tabs)...

ViewPager set current page programatically

android,android-fragments,android-viewpager
I wrote a custom ViewPager to disable Swipe Scroll, but I want to swipe programatically. I have three Tab in my view pager, but when I call viewPager.setCurrentItem(viewPager.getCurrentItem()+1) on the first Fragment, it moves to the third Fragment instead of the second Fragment. And if I call same function in...

Using Toolbar with Fragments

java,android,android-fragments,android-viewpager,android-toolbar
i am trying to create a viewpager that swipes through 3 different fragments each with a different toolbar. I have implemented the new toolbar in an activity before and got it to work however i am trying to get it to work with fragments Here is the fragment code @Override...

Interaction between fragments slow refresh

android,android-fragments,android-viewpager
On my screen I have 2 containers - left for 3 fragments in view pager, right for single fragment. From this on the right I increment some temp variable and through inteface I pass this variable to fragments. I switch fragments in view pager and everything seems to act all...

Android RecyclerView with Fragments

android,android-viewpager,recyclerview,fragmentpageradapter
I have a ViewPager with a FragmentPagerAdapter. My customer wants me to switch from ViewPager to list; a vertical list with all the fragments. There can be a lot of fragments, so adding them all in a ScrollView is out of the question. Can I somehow do this while still...

Dispatching ViewPager touch events to underlying view

android,events,android-viewpager,touch,dispatch
I have a ViewPager that has 2 pages. On 1 of them there is a custom view along with some other widgets. What I want is to disable paging if the touch event was used by that custom view. Here's the relevant code from my custom view: class OscilloscopeView extends...

How to drag one viewpager withrespect to another view pager in android

android,android-viewpager,swipe,drag
I have two view pager in a Same fragment. Both have same number of Items. My Need is When I Swipe a view pager the other view pager also need to swipe and vice Versa. How Can I implement that.

Android - Attempt to invoke virtual method 'void android.support.v4.app.Fragment.setMenuVisibility(boolean)' on a null object reference

android,android-fragments,android-viewpager,fragmentstatepageradapter
Here is the full stack trace of the error: http://pastebin.com/5dQHkUw3 The error started to appear only after I started using fragments in the project, because I want to give JSON feeds. It was fine before when I was creating Tabs, NavigationDrawer etc. MainActivity.java public class MainActivity extends ActionBarActivity implements MaterialTabListener{...

Using ViewPager and PagerTabStrip - extending FragmentActivity

android,android-fragments,android-viewpager,navigation-drawer,android-fragmentactivity
First - sorry for the newbish question. I've started building an app that has a single Activity and a navigation drawer. Each menu item loads a new fragment in the middle frame layout. I want to create another fragment that: has tabs allows for swipe scrolling It seems like the...

delay slide action when an image is clicked using viewpager android

android,android-viewpager,android-animation
I have created a slideshow in which i have disabled the default swipe action to slide screens. Instead when I click an image the slide performs. But I want to delay the slide for say t milliseconds after the image is clicked. The method of click action is onClickSlideDown. The...

OnTouchListener - Issue between click and swipe inside a ViewPager

java,android,android-viewpager,swipe,ontouchlistener
I have a ViewPager implemented without fragment (just view). Each page contains a list of elements. With a swipe movement, I can access the next page of the ViewPager, and with a click event, I can display information about the chosen element. In order to distinguish click and swipe actions,...

Update a viewepager on spinner action

android,android-fragments,android-viewpager
i have a viewpager with fragments, i want to update my viewpager with new fragments once i click on an item of my spinner. for now, whatever the spinner values are, the adapter dont update itself. this is what i have done so far : public class MainActivity extends FragmentActivity...

Mortar and Flow libraries vs. ViewPager

android,android-viewpager,flow,mortar,square-flow
I'm trying to adapt Mortar&Flow in my app and faced with an issue, that I can't make PageAdapter works with Screens, instead of Fragments. Anyone managed to get it right? I didn't succeed but, probably someone can guide me from this point: The initial Dagger Registration: @Module( injects = {...

How can I set the visibility for a xml element inside a fragment created via pager adapter?

java,android,android-fragments,android-viewpager
I have this activity that instantiates 5 different fragments that represents passengers and add them to a view pager in tabs. Each of those inflates the same xml file. What I want to do is be able to set the visibility for some of the xml fields in each of...

ViewPager in DrawerLayout

android,android-viewpager,navigation-drawer
I put a ViewPager in a DrawerLayout. Now when I try to scroll ViewPager, menu is closed please tell me how to make the menu does not close when I scroll viewPager viewPager adapter: public class MenuNewsAdapter extends PagerAdapter { ArrayList<News> news = new ArrayList<>(); Context context; public MenuNewsAdapter(Context context,...

Custom viewpager imageslider?

android,xml,android-viewpager
Although This is a solution ViewPager with previous and next page boundaries but it has limited scroll to only visible current image and does not work when i try to scroll from extreme left or right. I want side images from left and right to be a little smaller...

Calling Fragment from inside the BaseAdapter class in PageViewer Android

android,android-fragments,tabs,transactions,android-viewpager
Hi I am new to Android and am using PageViewer in my project to show Tab swiping and other such stuff I have used 4 tabs and and used fragments for each tab Now 1 of the tabs I have a list on which button is there to call another...

Hide Parent Fragment from the Fragment in the viewPager

android,listview,android-fragments,android-viewpager
I have a Fragment A holds a view pager that display serval nested fragments. B and C are the fragments directly hold by the view pager. And each B and C holds a listView. When click listView item fragment D will show up. The problem is that, I could only...

Dynamically add views to fragment hosted by Viewpager

android,android-fragments,android-viewpager
I'd like to add 7 previously created views dynamically to my viewpager. What I try to achieve at the end is a part of my screen (50dp height, match_parent width) looking like this. | VIEW 1 | VIEW 2 | When I swipe to the right, the displayed items will...

Use same Fragment class in ViewPager

android,android-fragments,android-viewpager
I have a ViewPager and I want to use the same Fragment type for all it's Views but I have a problem. Only the first View is actually updated. If I swipe to left/right I get an empty Fragment and if I swipe back I can see that the Fragment...

Fragment doesn't show properly in ViewPager

android,android-viewpager,fragment,framelayout
I have an Activity with a traditionnal viewpager component. This viewpager contains MainFragment class (it's a standard fragment). This is the layout of this fragment: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> </FrameLayout> Ps: I need to use this framelayout because I can switch with 2 fragments inside according an user...

The constructor is undefined working with dynamic ViewPager

java,android,json,gridview,android-viewpager
I am getting The constructor ImagePagerAdapter(ArrayList<Actors>) is undefined in ViewPagerActivity.java // The constructor ImagePagerAdapter(ArrayList<Actors>) is undefined ImagePagerAdapter pageradapter = new ImagePagerAdapter(fetchedList); I am using this tutorial to make a small photo gallery app, where i have two activities, first GridViewActivity and second ViewPagerActivity. I want to show tapped image in...

ViewPager's fragment without activity context

android,android-fragments,android-viewpager
Functionality: I'm developing some sort of configuration wizard, which may have many steps. Each step has it's own configuration, in this case, isSkippable() whether if user can skip the step or not. And a callback method when user taps on menu item to go to next step, or indeed completed...

How to set order of viewpager pages?

android,android-layout,android-viewpager
So I have a Viewpager class which is adding 3 fragments that each have their own layouts. Lets call them Layout/Fragment A, Layout/Fragment B, and Layout/Fragment C. ViewPager Class: public class viewpagerMainPagesActivity extends FragmentActivity { DescriptionPageAdapter pageAdapter; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.viewpager_descriptionpages); List<Fragment> fragments = getFragments(); pageAdapter =...

Setting action bar title in ViewPager

android,android-fragments,android-actionbar,android-viewpager
My ViewPager consists of many fragments .I am displaying title of fragment inside actionBar and i am using below code to set title .Since the ViewPager also initiates adjacent fragments I see in actionbar the title of next fragment.What should be the correct way to proceed in setting the title...

ViewPagerAdapter shows a null value

java,android,android-viewpager
I'm trying to implement sliding tabs in material design into my application. I found a tutorial and did the code according to it. I did some changes to implement on my app. Now i get a NullPointerException and cant figure out the reason. This is the tutorial i followed http://www.exoguru.com/android/material-design/navigation/android-sliding-tabs-with-material-design.html...

How can I resize my ViewPager depends on the size of my screen?

android,android-layout,resize,android-viewpager
I'm trying to resize my ViewPager depends on the screen size of a device. My ViewPager is at the center of screen and has only a width of 300dp. I want my ViewPager height to resize depends on the screen size. Underneath of my ViewPager it has a ImageView, this...

FragmentTabHost - No tab known for tag null

java,android,android-layout,android-viewpager,android-tabhost
Few days ago I implemented TabHostFramgent in a Fragment with a NavigationDrawer, and I faced with a problem that is the following error : java.lang.IllegalStateException: No tab known for tag null The thing is that all works perfectly since my first item list of my NavigationDrawer is my TabHostFragment, so...

Non stop auto scroll of viewpager in android

android-viewpager
I have used timer to auto swipe the viewpager. But after reaching the last page the timer stops. How to make it to continue again from the first page? final Handler mHandler = new Handler(); final Runnable mUpdateResults = new Runnable() { public void run() { pager.setCurrentItem(page++); } }; int...

Android: How to change the style of a ViewPager?

android,android-viewpager,android-styles,viewpagerindicator
activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v4.view.PagerTabStrip android:id="@+id/pager_header" android:layout_width="match_parent"...

How to choose adapter for view pager?

android,image,android-viewpager,android-adapter
I need to show images in ViewPager. But I don't know which adapter to choose: 1) PagerAdapter 2) Fragment Adapter. What is better for my task to display images?...

FragmentPagerAdapter does not return the correct view from getItem

java,android,arrays,android-fragments,android-viewpager
First of all , I have a list of fragment icons.add(new Home())); icons.add(new NewsFragment())); for (int i=0; i<gs.pages.size(); i++) { SchoolPg page = gs.pages.get(i); if (page.page_parent_id.equals("0")) { icons.add(new PageFragment()); } } icons.add(new InfoFragment()); As you can see, the first one is Home, then is News Fragment, then is a list...

Android MapView disappears using a ViewPager and PageTransformer

android,android-fragments,android-viewpager,android-mapview,android-pagetransformer
I'm having trouble setting up a ViewPager using a PageTransformer and a MapView. The problem is when the viewpager is set to use the PageTransformer, the mapview disappears(goes transparent) while panning. However, if I don't use a transformer and just pan the Mapview is fine. Does anyone know what is...

viewpager setonpagechangelistener deprecated

android,android-viewpager
Today i'm trying to set ViewPager.setOnPageChangeListener what i've found that it is deprecated. I've googled it a lot but not able to find answer. please help!...

Update listFragment when camera changes in MapFragment

android,android-viewpager,android-listfragment,mapfragment
I have an app with two fragments and I want to implement the ViewPager and ActionBarTabs to it. My question is: Is there any way to recreate my ListFragment each time when user moves camera in my MapFragment ? Each move assigns different values to an array which I use...

Getting error in viewpager adapter,java.lang.IllegalStateException: The specified child already has a parent

android,android-viewpager
I am trying to use viewpager with images but it shows only one picture if I slides it crashes, Saying java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. My adapter code is: public class NewDemoAdapter extends PagerAdapter { public ArrayList<Integer> imagelist;...

PagerAdapter with TouchImageView or GestureImageView not loading images

android,android-viewpager,android-pageradapter,touchimageview
When i am using simple imageview or AspectRatioImageView I am able to load images fetched from server. But if I am using TouchImageView or GestureImageView it is not able to load images. I see a blank screen. Apart from using UIL,I have tried some other ways of loading images also...

CircularFloatingActionMenu in Fragment of ViewPager

android,android-fragments,android-activity,android-viewpager,fragment
In my android application I have ViewPager with some Fragments. I wanted to use and show Circular Floating Action Button Menu in one of this Fragments but FAB somehow visiable in all Fragments. How to solve this problem and show FAB only in one Fragment. By the way it is...

How to get & use Widget Element's Action in fragment android

android,android-fragments,android-activity,android-actionbar,android-viewpager
In need of a good Ui design for my app with tab layout, i searched in google and i found one UI which is using View Pager and Action bar Tabs. Link is: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ i downloaded the template & imported to eclipse.i to tried use that template, don't know where...

ViewPager that listens to clicks

android,xamarin,android-viewpager
I need a ViewPager that enables to user to swipe images. But on a click on the images, a new activity has to start with another, bigger viewpager that contains the same images. How can i implement a click listener while still keeping the swipe on the viewpager?...

ViewPager not showing page content / not refreshing after changing the view

android,android-layout,android-fragments,android-viewpager
I am using ViewPager / FragmentPagerAdapter in one of my application fragments to display different listviews in each page (see the picture below) : The problem is that after i change the current view (Fragment) and i reopen it again, the listview isn't rendered (see the picture below) : The...

Register Broadcast receiver in Fragment PageViewer [closed]

android,android-fragments,android-viewpager,broadcastreceiver,android-manifest
I have previously asked a question in Stack for this and this is a continuing one for it Previous question Calling Fragment from inside the BaseAdapter class in PageViewer Android Now I click on button .. it goes to register but can seem to call the Fragment . I think...

Updating the contents on tab changed in view pager

android,tabs,android-viewpager,fragment,pagerslidingtabstrip
I am scracthing my head for past 1 day but unable to find the solution. In mine application there are two tabs under the toolbar First tab is USER-TAB the second one is ADMIN-TAB In both the tabs there are the listView. When a ListItem on the USER-TAB is clicked...

onClick not working in viewpager android

java,android,android-viewpager
I have made a slideshow using viewpager and disabled the default swipe functionality. Instead i want to change the slide when clicked on image.So i add a code in my viewpageradapter class but when i click on image it doesnt do anything. ViewPagerAdapter class is: package com.dekton.dektonapp; import android.content.Context; import...

Out of memory Exeption using Picasso

android,imageview,android-viewpager,out-of-memory,picasso
I need to show images in view pager. To show image in image view I use Picasso library. Also I resize image using screen size. So in my Activity in OnCreate I got view pager: mPager=(ViewPager)findViewById(R.id.pager); mPagerAdapter = new ScreenSlidePagerAdapter(); mPager.setAdapter(mPagerAdapter); Then get device size: Display display = getWindowManager().getDefaultDisplay(); Point...

add/remove fragment in viewpager using FragmentPagerAdapter

android,android-fragments,android-viewpager,fragmentpageradapter
I'm using FragmentPagerAdapter to load 4 fragments initially. Now i have another fragment which i want to show only when a click is performed (let say from a button inside other fragments) , and every time that fragment is bring to front, new data of should be in it. So...

Android get Tab position within fragment

android,android-fragments,android-viewpager
I have a view pager that uses the following fragments: Fragment1 - ViewPager holder Fragment2 What I want to do is get the tab position from with fragment2 or fragment3 e.g. In Fragment2 check if is at position 1 I know this sounds odd but I have one fragment that...

Dynamically changing fragment contents in a ViewPager

android,android-fragments,android-asynctask,android-viewpager
I have: A ViewPager with a FragmentPagerAdapter on (or a FragmentStatePagerAdapter, doesn't really solve my problem). A fixed number of fragments. They all share the same layout, but have TextViews that need to be set differently; An AsyncTask that queries my database and retrieves content to be set into the...

Why does this portion of google's android tutorial use “FragmentActivity”?

android,android-fragments,android-viewpager
It is taking me forever to learn the Android SDK. I am currently trying to implement swipe views with tabs by following this tutorial. I understand that we are supposed to use fragments as "mini activities", and that one fragment makes up of the many tabs attached to the ViewPager....

Android - saving a position of a page when pausing

android,android-fragments,android-viewpager
I got a ViewPager which saves the current page position (as the order in it's adapter). When the app goes to the backgroung, the ViewPager seem to lose the position it was last in and when switching to the app again, it starts at fragment with the position 0. How...

Edit framework class implementation Android for backward compatibility

android,performance,android-fragments,reflection,android-viewpager
I am trying to use ViewPager.PageTransformer interface in old Android 2.2 application. My target API is 8 Level. But there is known check in ViewPager compat library class if (Build.VERSION.SDK_INT >= 11) { final boolean hasTransformer = transformer != null; final boolean needsPopulate = hasTransformer != (mPageTransformer .... } So...

Android create vertical carousel with stacked views

android,android-viewpager,stack,carousel
I am trying to implement this carousel style thing. It would be basically stacked fragments above each other and I could scroll through them. When I scroll the very front one would move intuitively to back. Does anyone know any library for that or is it easily doable with ViewPager?...

How to change Viewpager tab colour dynamically?

android,tabs,android-actionbar,android-viewpager
How to change colour of Tabs like this? When I click/swipe to green or any other tab, the tab colour should change to that appropriate colour and rest of other tabs colour should change to black. How can I do this? Im using Viewpager. I tried this code inside onpagelistener:...

Android FragmentViewPager in Fragment

android,android-fragments,android-viewpager,fragment
I'm trying to implement a ViewPager into my fragment. Here is my Code: Parent fragment: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_parent, container, false); ViewPager viewPager = (ViewPager) view.findViewById(R.id.viewPager); adapter = new CustomPagerAdapter(getChildFragmentManager()); viewPager.setAdapter(adapter); viewPager.setCurrentItem(0); return view; } Childfragment: @Override public View onCreateView(LayoutInflater...

ViewPager/PagerAdapter shows all views on first page

c#,android,android-viewpager,monodroid,android-pageradapter
What's happening The ViewPager in my app shows all views I instantiated on page one. If I instantiate two views for example, both views are shown in page one, and the second page is just blank. Images showing the problem As you can see below, page one contains both pages...

Update Fragments within SlidingTabs

android,android-viewpager
According to this Tutorial I've implemented Sliding Tabs. The ViewPager holds 3 Fragments. In the first Fragment I add items to a sqlite table. In the second Fragment items of these tables are listed in a ListFragment. How can I achieve to trigger an update of the second view to...

Hiding FragmentStatePagerAdapter and SlidingTabs

android,android-viewpager
How to hide FragmentStatePagerAdapter, I mean I created sliding tabs with this adapter and I want to hide everything and create new Fragment in whole screen.

Fixed tabs with ViewPager Android

android,android-viewpager
I'm using ViewPager in my Android application, but I'm more worried, that the tabs are swipeable. I want tabs like Google playstore, it shows 3 or 4 tabs by default, and then tab slides only after 3rd tab. How can I achieve that kind of Tabs with Viewpager ?...

Android Fragment from Layout - Retain variable data

android,android-fragments,android-viewpager
I've been searching for hours and tried numerous methods but cannot seem to grasp my head around the idea / figure out how to retain/restore data in a ViewPager Fragment when it is destroyed and then recreated. Here is what I have - An activity where I setup the ViewPager...

Swipeable ViewPager with ActionBar Tabs (Null Object Reference)

android,android-fragments,android-viewpager,android-actionbar-tabs
I tried to follow a tutorial how to create a swipeable ViewPager with ActionBar Tabs. Everything is compiling fine, but when I try to start the activity, it crashes with this error: Attempt to invoke virtual method 'void android.support.v4.view.ViewPager.setAdapter(android.support.v4.view.PagerAdapter)' on a null object reference This is my adapter: public class...

change the size of Fragment tabs using ViewPager

android,android-fragments,android-viewpager
I want to change the size of fragment tabs. is there any way?? that we can change the size of fragment tabs created using View Pager and Fragments ??

How to implement this widget?

android,android-viewpager
On the homepage of World of Warships I have seen a nice Widget that allows the user to flip left and right through different "Views" (I guess it's a customized GWT-widget (Google Web Toolkit), but I'm, not sure). When flipping some neat animation is shown. How to implement this on...

Recyclerviews in ViewPager

java,android,listview,android-viewpager,recyclerview
I'm trying to get this working: I basically want two Recyclerviews in one ViewPager. I followed this Tutorial: http://android-java-development.blogspot.de/2012/05/system.html, but it doesn't seem to work. I looks like the view pager is empty and the recycler view doesn't show up. Here's my layout code: <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/pager_refresh_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="@dimen/tab_height"> <android.support.v4.view.ViewPager...

Android viewPager and Fragment interface loading

android,android-fragments,android-viewpager
I am using a viewpager and 3 fragments(representing 3 pages). 2 of the pages are have identical fields. When I swipe between pages/fragments, the onscreen variables seem to get confused between fragment1 and fragment2. I was wondering, are the fragment variables cached, and somehow Java/Android thinks the variables on each...

how to handle Gridview Click in ViewPager?

android,gridview,android-viewpager
I m create gridview in my FragmentA class and when i click gridview position say 0 then its navigate to FragmentB class and again when i clicked position 1 then its navigate to FragmentC class But my problem is that when we come back in my FragmentA class then my...

ViewPager.setAdapter() throwing NullPointException; viewPager and pagerAdapter don't seem null?

java,android,android-activity,android-viewpager
So I am messing around with using ViewPager in tandem with Navigation Drawer. I have the Navigation Drawer working. However, attempting to call viewPager.setAdapter(pagerAdapter) is throwing a NullPointerException. I am checking both viewPager and pagerAdapter for null, but here is what happens when I attempt to Log calls to their...

ViewPager Is Not Scrolling Smoothly

android,android-viewpager
i implemented a viewpager in my activity that on scroll, loads a set of data to an adapter and display them in a list view. everything is working fine, but i cant seem to find out how to make it more efficient because when scrolling, the view freezes but for...

SwipeDismissListViewTouchListener in ListView and ViewPager

android,listview,android-viewpager,ontouchlistener
I have a ViewPager that contains a ListFragment with a TouchListener (SwipeDismissListViewTouchListener). I modified the ViewPager like this: public class CustomViewPager extends ViewPager { public CustomViewPager(Context context, AttributeSet attrs) { super(context, attrs); } private boolean pagingEnabled = true; public void setPagingEnabled(boolean enabled) { pagingEnabled = enabled; } @Override public boolean...

Android Viewpager display wrong data on first load

android,android-fragments,tabs,android-viewpager,android-tabhost
/**i'm using android.support.v4.view.ViewPager with tabhost for show a tab data, i have 3 tab when first time it is load 1st tab is load 3rd tab data ...3rd tab is load 1st tab data .and 2nd tab is correctly loads own data My Code For viewpager and tabhost is Thx...

ViewPager.PageTransformer Android

android,android-viewpager
I want to do the following, Create grid of images using GridLayout inside a ScrollVIew inside a ViewPager, let's say I have pages of pictures, page 1 is animals, page2 plants, etc. And I want to be able to scroll up and down to view the images, of animals on...

E/AndroidRuntime﹕ FATAL EXCEPTION, Viewpager Android

java,android,android-viewpager
while I test my android app, I get the follow error in the Android-Studio-Console: 04-30 17:06:19.811 2431-2431/com.example.aliencomputing.kakamila E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.aliencomputing.kakamila, PID: 2431 android.view.InflateException: Binary XML file line #48: Error inflating class <unknown> at android.view.LayoutInflater.createView(LayoutInflater.java:633) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55) at...

Fix Viewpager Android Views

java,android,android-viewpager
I have Android application with a tabbed viewpager see the image screenshot of the running app http://i.stack.imgur.com/zhlKF.png The problem is that i see blank pages instead my xml layout referenced with fragment classes, What is the correct way to write the XML file to be supported by the Viewpager Here...

Add tab under android.app.fragment

android,android-fragments,tabs,android-viewpager
I want to add tabs inside android.app.fragment and not to be in action bar All solutions on the web are talking about tabs inside an activity, tabs in the action bar, tabs inside android.support.v4.app.Fragment this is available in my case. Thank you...

FragmentPagerAdapter update title dynamically

android,android-fragments,android-viewpager
I have a ViewPager with FragmentPagerAdapter, which has 3 Fragments. Now, I have a number of items as part of the title of the fragment: So user can add or remove those items, and title should update accordingly. However, this title seems static. How can one recall this method to...

Layout Jitter when Toolbar hides while scrolling RecyclerView

android,scroll,android-viewpager,recyclerview,android-toolbar
Hi , I have a layout with Toolbar, PageSlidingTab and ViewPager. Inside ViewPager there is a fragment with RecyclerView. I want to hide the Toolbar as i scroll the RecyclerView. I have achieved it by adding the following code : toolbar = ((MyActivity)getActivity()).getToolbar(); mRecyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() { int toolbarMarginOffset =...

Which event to be used to detect click event from view pager adapter in android

android,android-viewpager
What I am doing: I have a ViewPager, where i add images to ImageView in every View that I create At the same time I am setting a TAG value to it I am using Activities What i want to do: At the runtime when I click on the particular...

FragmentPagerAdapter: IllegalStateException Can't change container ID of fragment

android,android-fragments,android-viewpager
First: Sorry for the wall of text/code, but I think most of it is needed to understand the problem. I am creating an app using Fragments in a ViewPager and a TabHost. The ViewPager has a custom FragmentPagerAdapter that will feed the various pages in the ViewPager. I have ran...

Recursive entry to executePendingTransactions, even with getChildFragmentManager

java,android,android-fragments,android-viewpager
I have an activity with a viewpager that contains 3 fragments. In one of the 3 fragments I have another viewpager, now I learned that when you want te embed a fragment in a fragment you gotta use getChildFragmentManager but for some reason it doesn't work with me. I have...

Android - Support Multilanguage app in a ViewPager

android,android-viewpager,locale,multilanguage,screen-rotation
I have a ViewPager with FragmentPagerAdapter and five tabs that is called from my MainActivity. I want to change dynamically the language of my App. To do this, i saved my language preference in my onSavedInstanceState like this: @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); String...

Viewpager PageScrollStateChanged called multiple times

android,android-viewpager
I was wondering if it's normal that PageScrollStateChanged, an event of a ViewPager, is called 3 times when swiping the viewpager

Android Wear DotsPageIndicator fades first time instead of always visible

android,android-viewpager,android-wear
DotsPageIndicator always fades out the first time it is shown. I tried setDotFadeWhenIdle(false); but then it fades out and never comes back. I just want it to be shown all the time and never fade out. I saw this question: Android Wear DotsPageIndicator only fades when first created but this...

Refresh fragment inside viewpager

android,android-fragments,android-viewpager,android-fragmentactivity,viewpagerindicator
In my example am having a view pager inside a fragment and tabs in View pager are crated dynamically. For example, am having tab for three subjects Sub 1, Sub 2, Sub 3 each subject tab having some number of questions. Now what i want is when i switch from...

Can't switch PreferenceFragment from ActionBarActivity

android,android-viewpager,appcompat,preferencefragment
Hi i have an activity that extends ActionBarActivity. This one, has a ViewPager using PagerSlidingTabStrip library. I'm using AppCompat v21 so i need extends ActionBarActivity to use the toolbar. By the way.. I have two PreferenceFragment that i need put in this viewpager. import com.astuetz.PagerSlidingTabStrip; import com.zst.app.multiwindowsidebar.preference.*; import com.zst.app.multiwindowsidebar.sidebar.SidebarService; import...

how to close viewpager images in android

android,android-viewpager
I am developing an app in which I am using a ViewPager to slide images in an Activity. There is a sign up screen on that Activity. When I sign up, the Activity opens and the images can slide (for that I use a ViewPager). It also contains a button...