Questions tagged [android-fragments]

Fragments represent reusable behaviors or portions of user interface in an Android app.

0
votes
2answers
16 views

Unable to attach adapter for recycler view in fragment

In my app I am using recycler view in fragment. That recycler view data comes from database. I get all data perfectly but all data overlap each other and getting an error in log cat.I am using card ...
1
vote
2answers
32 views

adding fragment to xml crashes my app - how to fix that?

it's my first time dealing with fragments in android. and for some reason my app crashes when i try to add fragment tag to my main activity. i know there is a lot of questions similar to mine but i ...
0
votes
0answers
14 views

How to perform form validation in a viewpager and restrict user from swiping to next fragment until all fields are filled?

I have a viewpager that has 6 fragments each containing different input fields. I want to validate each fragment before user moves to next fragment. the viewpager is in an activity.
0
votes
0answers
10 views

Update or manage each pager of a viewpager data

I'm having trouble with a problem with ViewPager. I have a viewpager with a number of view (tab) generated according to the size of the agencies according to the content of the JSON that retrieves. ...
0
votes
0answers
5 views

Google maps and BottomNavigationView

I'm trying to setup google maps inside of BottomNavigationView tab using MvRx. I have to questions: What is the best pracice for setting up BottomNavigationView in MvRx? Using the code below I ...
0
votes
1answer
21 views

Single progress bar for for 3 activities, each containing a different form [on hold]

I am new to Android. I have created 3 activities, each containing a form. I want to create a single progress bar that is shared among the 3 activities and the progress bar is placed at the top of each ...
-1
votes
2answers
31 views

how to perform onCLick Listener in tablayout in fragment?

Hello there i am making swipeable tablayout with view Pager. Swipe in this fragment is working fine but it does't perform the onclick event. Swipe is working on TabLayout click is not working ? How to ...
0
votes
1answer
63 views

Convert a JSON Object into JSON Array

I am working on functionality in which I have assembled multiple types of data into one. And I have converted my data in to JSON object but the problem is that in one API I need it in JSON Object ...
0
votes
1answer
40 views

Should a fragment always be placed on top of an empty activity?

In my app, I am putting a Fragment on top of an Activity that contains a RecyclerView and a FloatingActionButton. This comes with a few problems, which can be solved, but the solutions feel kinda ...
0
votes
0answers
25 views

Fragement & customized GridView

I want to make a customized GridView in my Fragment ,but it cant open the page for a long time. I want to setText and button in my Fragment (the fragment in the activity Using many Picture in my ...
0
votes
2answers
42 views

Fragment Lifecycle

I'm trying to understand the internal behavior of Android fragments. Got doubts between exact difference between onDestroy(), onDetach() and void onDestroy () Called when the fragment is no longer ...
0
votes
3answers
41 views

How to start a Media Player from MainActivity when i press button from a Fragment

I have the buttons oferton, atrape, smiders, imbecil, billetes, and tonto, what I want to do for Example: I want to press the button oferton from the fragment Frag1 and then start the media player ...
0
votes
0answers
9 views

Show ProgressDialog in a fragment with recyclerview that is itself in a fragment

I want to Show ProgressDialog in a fragment with recyclerview that is itself in a fragment. I want to show the progressdialog when the data is loading in my second fragment. Here is my code for the ...
0
votes
2answers
29 views

How to use an number editText in a fragment

I want to use a editText with the type number in a fragment. If I use this, it doens´t work: private Number editText; @Override public View onCreateView(LayoutInflater inflater, ViewGroup ...
0
votes
0answers
11 views

Share mapbox map between fragments

I have application with several fragments and most of them use map view. I use base fragment for each of them and do all mapboxMap configuration in they. for example: inside fragment I do call : ...
0
votes
0answers
10 views

MvRx: Google maps and BottomNavigationView

I'm trying to setup google maps inside of BottomNavigationView tab using MvRx. I have to questions: What is the best pracice for setting up BottomNavigationView in MvRx? Using the code below I ...
0
votes
0answers
8 views

ViewPager with FragmentStatePagerAdapter issues that are manifesting only on Android 8.0+ Oreo

I have an android app which exists for quite a while and everything runs as it should except on Android Oreo. There is a ViewPager with many different types of fragments with various complexity each. ...
0
votes
2answers
20 views

How to store all child fragment classes to the parent class' instance

I'm working on a "home feed"-like feature where there's a main Fragment with several other fragments added to its layout, making up the content page. I'd like the main fragment class to be able to ...
0
votes
0answers
22 views

Fragment transaction is lagging when adding (or re entering) a fragment while adding data to a recyclerview

I have some lag related issues with my fragment transactions, when switching to a fragment that asre showing recyclerviews with data. The more data and complex it is, the more the transaction is ...
0
votes
1answer
9 views

How do i get data from my webservice a fragment instead of activity?

so I have a listview in one of my fragments, and I want to import som data from my database via my webservice till that listview. I have done this multiple times from a webservice to an activities, ...
-2
votes
0answers
21 views

How to Add Tab fragment with different data using loop

I'm try to add Tab fragment using loop. Each Tab Fragment will have different data based on the date passed in each fragment. I'm able to add fragments using loops but not able to show different data ...
-2
votes
2answers
22 views

Select position of CardView in RecyclerView and Change Fragment in RecyclerView [on hold]

* EASY PART * At the moment I have set up a CardView inside a RecyclerView. What i need to do is to change the color of the 2nd cardview to yellow, and the 3rd cardview to red (At the moment they ...
1
vote
1answer
27 views

How to get the support fragment manager from ThemedReactContext?

Environment Environment: OS: macOS High Sierra 10.13.4 Node: 8.11.3 Yarn: Not Found npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.1 AI-173.4907809 ...
-1
votes
0answers
19 views

how to show hamburger icon when change toolbar in navigation drawer fragment

my problem is same with this and this but i can't get the exact answer. Can someone provide better solution? i'm implementing collapsing toolbar in a fragment that different from toolbar in main ...
0
votes
0answers
15 views

Android WebViewClient find if its user-click or auto-redirect?

I understand that whenever a redirect happens WebViewClient.shouldOverrideUrlLoading(WebView wv, String url) gets called for both user-click and auto-redirect. Requirement is to perform a special ...
1
vote
0answers
11 views

Communication between service and fragments

I have a PageView with multiple fragments and a bind Service. I connect to the service from each fragment the following way: private ServiceConnection mConnection = new ServiceConnection() { @...
1
vote
0answers
18 views

Fragment change & Select Position of CardView in RecyclerView

* EASY PART * At the moment I have set up a CardView inside a RecyclerView. What i need to do is to change the color of the 2nd cardview to yellow, and the 3rd cardview to red (At the moment they ...
0
votes
3answers
28 views

My findViewByid turn red on extend fragment, im doing on onCreate method not in onCreateView method

find view by id marked red, I'm not doing it to onCreateView, help me to solve this kind of error, I'm really new in android programming package com.example.mymonitoring; public class ...
0
votes
4answers
42 views

Android RecyclerView NullPointerException

Currently i'm working a project, where i need to implement a RecyclerView/CardView. From MainActivity i call fragments in a switch case, where all fragments work. Whenever i press on the Fragment ...
1
vote
2answers
31 views

Fragment Recyclerview onCreateView, onViewCreated or onActivityCreated?

Should i initialize my recyclerview in onCreateView, onViewCreated or onActivityCreated? What's the difference between those 3, i searched for explanations but some people say to use onCreateView and ...
0
votes
0answers
13 views

Navigation drawer doesn't show up when opening fragment with button, but shows up when opening with navigation drawer

So i have navigation drawer with a few fragments in it. One of the fragments contains a button which leads to another fragment, but the problem is, that the navigation drawer is invisible(it still ...
-2
votes
0answers
28 views

How to get (layout) inside adapter with different position in Android Studio?

I need the layout of particular position, so I show the change background effect: I have a function ChangeBackgroundColorAnimation(Context context, final View itemView). I have Holder, previous ...
1
vote
2answers
45 views

Android viewpager lagging with recyclerviews

I have viewpager that contains 3 fragment, in those fragments there is no imageview but just simple cells. When I am switching to longer fragment (recyclerview has more items) viewpager is lagging. ...
2
votes
3answers
68 views

Bug: exchange between fragments

I will try to explain at best, adding references and images in which I think it is difficult to explain in words the error I encountered. Working with the fragments and the Navigation Drawer I've ...
0
votes
0answers
35 views

On Click of an item in a recycler adapter in a fragment, display a custom popup

I have a recycler view adapter inside a fragment. On click of the items in the adapter, I want to display a custom popup. Following is the code for the same In onBindViewHolder: holder....
0
votes
1answer
23 views

Android Navigation Drawer with fragments that open other sub fragments

I'm developing an Android app (I'm a newbie) that uses a Navigation Drawer. I've created multiple fragments that represent the various item in the side menu. One of them has a RecyclerView, and I want ...
0
votes
4answers
61 views

RecyclerView is loading twice product on click event in recyclerView in android

i have applied recyclerView in fragment in which i am showing product from api that is working fine. i have performed click listener on recyclerView, when i click the product and go to next fragment. ...
-3
votes
0answers
26 views

Please give me idea to develop Bus Seat Layout like Upper and Lower Deck based on Row and Column wise or any code for this [on hold]

where Zindex=0 for Lower deck, Zindex=1 for Upper deck I am using API for getting all this values Update: Please check out this code on github https://github.com/hiteshsahu/Ticket-Booking-...
-2
votes
0answers
25 views

How can I learn advanced animations for android? [on hold]

I want learn advanced animations for creating my app, I can develop basic apps with simple position, size, rotation, and the alpha animations but I want to animate buttons to change there shape and ...
0
votes
4answers
45 views

Android Fragment Crash

App wont even open. Fixed last time by Implementing Fragment Interaction Listeners. I believe this error has to do with my onAnswerFragmentInteractionListener and my OnFragmentInteractionListener. ...
0
votes
2answers
20 views

Android: RecycleView not getting populated

I know it had been asked multiple times but I can't find the solution for this. Basically My RecycleView is not being populated. No method of the adapter gets called (onBindViewHolder, ...
0
votes
0answers
27 views

Trying to access fragment method from parent activity in viewpager

I have an activity called CBT_practice that houses fragments: objective_fragment, subjective_fragment and theory_fragment. These fragments are added to the activity dynamically with viewpager. But I ...
1
vote
2answers
56 views

IllegalStateException: Fragment already added

I got this error: java.lang.IllegalStateException: Fragment already added: MenuBottomSheetFragment{d476429 #0} at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1891) ...
0
votes
1answer
24 views

Navigation Component can't pop to exit app

Using Android's Navigation Component, I have 3 fragments hosted by a single Activity. The launch fragment is a splash screen fragment (A), if the user is not logged in, I launch the login fragment (B),...
0
votes
0answers
15 views

How to listen and react to changes to a RecyclerView adapter's data in a fragment/activity?

So, I have a custom PlaceAutocompleteAdapter on a screen with an EditText and some other views that are hidden when the RecyclerView is shown. When a place is clicked in the Suggestions list, the ...
0
votes
1answer
11 views

I am unable to use searchView with multiple fragments

In my application I have two fragments Fragment Card, Fragment Note. I am using ViewPager and TabLayout to sliding between two fragments. I want to implement a search function in my application. This ...
1
vote
1answer
51 views

Recycler View not showing in fragment

I have three fragments: Fragment user, Fragment Home and Fragment Progress. I'm trying to implement a recylcer view in the homefragment that can recycle images in the recycler view nothing is ...
-1
votes
1answer
43 views

How to Disable Snackbar on Tab change in TabLayout

When application is started I am showing Snackbar if Internet connection is not available in my TabLayout Fragments.I have added Retry action to Snackbar to check for Internet.If Retry is pressed and ...
0
votes
1answer
35 views

If I add a new transaction(adding fragment, no removing) to the fragment backstack, do the fragment objects in previous transaction get copied or used

So let's say for my first transaction I add Fragment A, add to backstack, and commit. For my second transaction, I add Fragment B, add to backstack, and commit. At this point after my second ...