Questions tagged [fragmentpageradapter]

FragmentPagerAdapter is a subclass of the PagerAdapter class from the Android compatibility package that represents each page, in the ViewPager where is used, as a Fragment.

Filter by
Sorted by
Tagged with
0 votes
0 answers
24 views

Type mismatch: inferred type is SectionPagerAdapter but RecyclerView.Adapter<(raw) RecyclerView.ViewHolder!>? was expected

I learned about SectionPagerAdapter & RecyclerViews and tried to create one after watching this tutorial. Everything was going fine until the end when I got an error while running the code The ...
Zainal Abidin's user avatar
0 votes
1 answer
49 views

FragmentPagerAdapter is deprecated problem

Android Studio says fragment pager adapter is deprecated. How can I remove this error? here is the screenshot public static class ViewPagerAdapter extends FragmentPagerAdapter { private ArrayList&...
Mustafa's user avatar
0 votes
0 answers
135 views

How to set primary item after update to viewpager2 and FragmentStateAdapter?

I'm looking into an opensource project on github and it still currently makes use of ViewPager and FragmentStatePagerAdapter. I'm trying to update it to use ViewPager2 and FragmentStateAdapter but ...
Bluming's user avatar
0 votes
1 answer
28 views

viewpager call only 2 oncreateview

i have 4 Fragments in viewpager but if i get into activity that have viewpager only 2 fragments call oncreateview so remain fragments cant call their component and occurs null pointer error i have ...
user19632259's user avatar
3 votes
2 answers
392 views

RecyclerView onClick event is not working with SwipeRefreshLayout?

Before using FragmentStateAdapter. I was using FragmentPagerAdapter then everything was fine but when I migrated from FragmentPagerAdapter to FragmentStateAdapter to reduce memory usage. The issue ...
M DEV's user avatar
  • 773
0 votes
0 answers
141 views

FragmentPagerAdapter class is deprecated. How to solve FragmentPagerAdapter issue

FragmentPagerAdapter class is deprecated Since API 27 FragmentPagerAdapter is deprecated. What's the best alternative to use for this? How to solve FragmentPagerAdapter issue. Follow my code you ...
Shyam Buhecha's user avatar
0 votes
0 answers
207 views

App crashes when returing to MainActivity after screen rotation

When i go from MainActivity to EditTaskActivity (a screen where you can edit task options), rotate the screen and then try to save the task, the app crashes. Now i found out that it crashes inside ...
Tomas Loksa's user avatar
1 vote
1 answer
425 views

Using ViewPager2 with TabLayout and fragments. Able to swap fragments, updated fragment not showing unless the user browses to another tab first

I am updating an application that was written in 2014. The fragment that I would like to update (refresh) uses the following code, public void fragmentRefresh(View view) { FragmentTransaction ft = ...
portsample's user avatar
  • 1,986
0 votes
1 answer
439 views

Move to next slide on clicking radio button inside View Pager

I am making an app that contains a small questionnaire for users asking them about their food preferences. To achieve this, I am trying to create a ViewPager whose layout contains Radiobuttons inside ...
VaM999's user avatar
  • 463
0 votes
1 answer
811 views

How to extends FragmentPagerAdapter class?

When I try to extend their class, the FragmentPagerAdapter is deprecated in my Android Studio page code. The problem is very annoying. I have searched a lot but have not found any results. Please have ...
samar script's user avatar
0 votes
1 answer
40 views

Is it safe to assume that adjacent fragments in a ViewPager will always have their UI active?

I have a ViewPager with FragmentPagerAdapter. I don't override offscreenPageLimit property with setOffscreenPageLimit of my ViewPager. So, in this case the value of the offscreenPageLimit is 1 which ...
starwarrior8809's user avatar
3 votes
1 answer
3k views

java.lang.IllegalStateException: Fragment already added: MovieFragment

got error fragment already added on my MyPagerAdapter class which extends FragmentPagerAdapter this is my error logs E/AndroidRuntime: FATAL EXCEPTION: main Process: id.cahyowhy....
cahyowhy's user avatar
  • 553
0 votes
0 answers
421 views

In ViewPager2 recreate fragment at specific index

I'm using ViewPager2 and with FragmentStateAdapter to retain state of fragments. I show 2 fragments in the pager when user is loggedOut but when user logins again the i want to recreate only the 2nd ...
Usman Rana's user avatar
  • 2,067
1 vote
1 answer
341 views

Switch to Fragment through swipe up/down

I'm having some trouble with implementing a certain feature within my app. What I would like to achieve is being able to swipe up/down to see certain fragments. I am currently using a ViewPager to ...
Jorn Rigter's user avatar
0 votes
1 answer
27 views

updating data in ListViews displayed with a FragmentPagerAdapter

i try to display Datasets in severel Listview in a fragment in a FragmentPagerAdapter. The different datasets partly depend on each other (if displayed data in tab A get's changed, data in tab B ...
Lazale's user avatar
  • 1
0 votes
1 answer
300 views

SectionsStatePagerAdapter deprecated error

I have developed a section state pager adapter that is meant to help with the fragments in the account settings of the mobile application. However I can't seem to figure out where I've gone wrong. ...
Joe's user avatar
  • 263
2 votes
1 answer
151 views

Fragment in ViewPager using FragmentPagerAdapter is blank the first time activity is loaded

I'm creating an app with vertical page adapter using FragmentStatePagerAdapter. The big issue i'm facing is, data is not displayed on the textview on first app launch but is displayed on scrolling the ...
Daniel Nyamasyo's user avatar
1 vote
0 answers
124 views

FindViewById is null after device rotation inside FragmentPagerAdapter

I am trying to modify UI elements that are inside a FragmentPagerAdapter on a ViewPager. Everything goes well until I rotate the device. Then, FindViewById returns null and I can't modify the element....
Irene's user avatar
  • 11
0 votes
0 answers
1k views

error: cannot find symbol variable viewpager ---Androidx

I have the following code, the project is migrated to andoidx, R.id.viewpager returns can not find symbol variable viewpager SimpleFragmentPagerAdapter is a custom(an extention of) ...
user3922145's user avatar
2 votes
1 answer
83 views

tabs with date as title

I need tab layouts with the titles as dates in it. In my pager adapter I'm using the following code. private static final int[] TAB_TITLES = new int[]{R.string.home_tab1, R.string.home_tab2, R.string....
deluxan's user avatar
  • 372
0 votes
1 answer
137 views

Fragment inside Viewpager not show when revisited

I have two fragments in my Activity. One contains a viewpager which also has two fragments in it. Everything works fine but the problem is when i re-visit the fragment containing the viewpager from ...
Capton's user avatar
  • 67
0 votes
3 answers
705 views

getResources() not working in FragmentPagerAdapter [duplicate]

I try to populate tab titles in FragmentPagerAdapter by strings from string.xml. I check a few different ways to do that based on StackOverlow or another sources. Below I present my newest version of ...
Tomiszen's user avatar
0 votes
1 answer
155 views

FragmentPagerAdapter always starts from the first page

I have a Fragment pager adapter with five fragments and inside the third fragment I want to call an other activity which sends a selected picture to the container. It works fine but, every time the ...
hathamegis's user avatar
0 votes
0 answers
22 views

ListView SimpleCursorAdapter FragmentPagerAdapter Tabs

I thought long and hard about how to represent this problem. I thought that there is too much code but that I can describe it simply. And that this will probably tip someone off as to where the ...
JJJones_3860's user avatar
  • 1,382
0 votes
1 answer
39 views

How to get the current item inside FragmentPagerAdapter?

I have the following code - @Override public void sendDeviceIdResult(String deviceId, boolean isAlreadyExist) { int currentItem = viewPager.getCurrentItem(); Fragment item = adapter....
Alon Shlider's user avatar
  • 1,187
2 votes
2 answers
1k views

Getting user-input information back from viewPager fragments (Kotlin)

I'm working in Android Studio and I've run into an issue I've never encountered before. I'm making an interface that brings in JSON to create custom forms and creates a series of tab-controlled ...
BBurchfield's user avatar
1 vote
0 answers
811 views

Exoplayer not stopping after app closes in PagerAdapter

I have problem with Exoplayer to stopping after the app is closed down, or the fragment is changed from the BottomNavigationView, I get the data from my API that is cast to a Recyclerview/Adapter that ...
JonathanNet's user avatar
  • 1,657
1 vote
0 answers
209 views

Using Tabs Navigation in Xamarin Android MvvmCross return incorrect index

I need advice from an MvvmCross expert!! I have recently taken over a codebase that is an Android/iOS app using Xamarin Native and MvvmCross. The app has a TabView as the main navigation pattern and ...
Sev's user avatar
  • 883
1 vote
1 answer
840 views

How to change fragment inside getItem of FragmentStatePagerAdapter

I have this code, where I want the first fragment of my FragmentStatePageAdapter(inside a viewpager), to change, depending on some boolean values. inner class MainFragmentAdapter(fragmentManager: ...
Mikkel Larsen's user avatar
0 votes
2 answers
140 views

How to understand getFragments.size() giving me 2 when I've got 3 tabs in TabLayout each showing the right fragment?

I've got TabLayout with 3 tabs created via ViewPager using FragmentPagerAdapter and 3 fragments. Swiping to the third tab, breaks one bit of the first tab and changes the indexing of the fragments. I'...
djevulen's user avatar
  • 112
1 vote
0 answers
46 views

TimeoutException on ViewPager setAdapter Android

I am developing Android App and I am using view pager inside a fragment but when I tried to setAdapter it's showing me Failed to execute a task. java.util.concurrent.TimeoutException Here how I am ...
Harsh Shah's user avatar
  • 2,182
0 votes
1 answer
139 views

Remove Fragment Page from ViewPager

I'm trying to dynamically add and remove Fragments from a ViewPager, adding works without any problems, but removing doesn't work at all. What am I doing wrong? Please help. I've tried many solutions....
Janusz Starko's user avatar
1 vote
2 answers
592 views

First Fragment View not loading when navigate from third fragment

Here when I landed to first fragment all views are loaded and scrolling but when I come from third fragment i.e from some other activity I need to land in third fragment,and when navigate to first ...
Girish's user avatar
  • 2,216
3 votes
1 answer
3k views

Vertical ViewPager with smooth scrolling and page transformation like inshorts app

I wanted to make a Vertical ViewPager looklike inshorts application. I have tried several solutions found on Stack Overflow and in Github. All of them have the same way of implementation of code, and ...
Ranjan's user avatar
  • 1,326
105 votes
7 answers
85k views

FragmentPagerAdapter deprecated

Since API 27 FragmentPagerAdapter is deprecated. What's the best alternative to use for this? In my case, I understand something like super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) ...
wbk727's user avatar
  • 8,047
0 votes
4 answers
4k views

TabLayout don't get populated with ViewPager at all

I try to populate a TabLayout with a ViewPager but unfortunately it doesn't get populated. I followed this tutorial to get in touch: TabLayout and ViewPager in your Android App. The tutorial uses the ...
Lecram's user avatar
  • 58
0 votes
0 answers
15 views

How can I switch between fragments on the click of a button and transfer data from one another?

This is the code I'm dealing with right now - we were given it during class and I didn't fully understand it and i'm trying to do so and add some features too - that's why I'm here. MAIN ACTIVITY: ...
Tisho's user avatar
  • 1
-1 votes
1 answer
318 views

i have a dynamic tablayout but every time i push back button and re-enter my app again , my tab doubles , why?

in my TabLayout i create my login TabItem dynamically at the onCreate() method of my MainActivity , but every time i exit from my application with back button and i re-enter my app , it creates that ...
Geco's user avatar
  • 177
0 votes
0 answers
40 views

How to build a ViewPager to slide large images?

I´m trying to use a ViewPager to slide a group of images using a FragmentPagerAdapter. So each instance of my fragment will show a single image. I will describe below my understanding of how to do it:...
Gio's user avatar
  • 210
3 votes
0 answers
216 views

onLoadFinished() not getting called, but onCreateLoader() is called

I am using CursorLoader to load data from database inside my Fragment, which has a RecyclerView. This fragment is being used inside a ViewPager. The ViewPager is contained inside a ContainerFragment, ...
Anand Goswami's user avatar
0 votes
2 answers
463 views

how to fix" 3 fragment in One activity with viewPager need validation first two page then possible to go third page"

I want to create a createOrderActivity where has three fragments like Service info, ScheduleInfo, confirmation the service info fragment has editText if click NextButton(which is situated ...
amirul's user avatar
  • 380
1 vote
1 answer
84 views

ViewPager Fragment RecycleView Reset

I have 3 fragments in the ViewPager. PersonalFragment CropFragment NotesFragment Every fragment has a RecyclerView and I was adding items using a dialog in it. However, when I go to the last ...
Prashant Gosai's user avatar
0 votes
2 answers
992 views

How to use the FragmentPagerAdapter with unique unrelated fragments?

I am trying to implement a simple swiping action between the three main screens of my app (feed, forum & profile). I've been looking for guides online but they all seem to take the same approach ...
Tsabary's user avatar
  • 3,207
3 votes
3 answers
2k views

How to pass data between fragments in FragmentPagerAdapter

For my academic project, I want create an application with 4 tabs. The first one will show recent games added to a list, the second one will be a search form, the third will show the search result, ...
Tasos Karatzoglou's user avatar
0 votes
0 answers
102 views

How to make not selected fragments appear a little smaller than the currently selected fragment

I'm using a FragmentPagerAdapter to create carousel between 3 fragments. I've achieved it, but I'd like to make the adjacent fragment appear a little smaller, like in the following: My code: ...
Poider12's user avatar
  • 223
0 votes
1 answer
154 views

SearchView cancels with page change but doesn't clear properly

I have a fragment pager that pages between instances of the same Fragment. On top of those fragments, a search function is implemented via a SearchView in the App bar. The user should be able to ...
TomQDRS's user avatar
  • 885
0 votes
1 answer
87 views

Refreshing Data in a fragment using FragmentPagerAdapter

I have three fragments in my Pager and i am adding some strings using Bundle while instantiating each fragment in my adapter. I am using these strings to filter out the data that i am fetching from ...
depp's user avatar
  • 25
0 votes
1 answer
114 views

viewpager,recylerview not working if using same fragment for all tabs

i am using the same fragment for all the tabs. But the problem is scroll of the recycler view of fragment working for last tab only. Recycler view not scrolling for the previous tabs. Below is my ...
Deepak Rana's user avatar
0 votes
0 answers
166 views

Fill linearlayout with cardviews and viewpager

I have an issue trying to fill a linear layout with cardviews inside, and inside of these, a view pager that is filled with two fragments. the fragments are filled with data stored in an SQLite ...
jdediegomrt's user avatar
0 votes
1 answer
714 views

FragmentPagerAdapter Fragment getItem wrong position?

So for some reason i'm getting a wrong position when i switch tabs on my tabbed activity. At the bottom of my post you can see my logcat when i start my app, tab 1 and tab 2 their oncreateview is ...
Vince VD's user avatar
  • 1,516

1
2 3 4 5
13