My app uses a BottomNavigationBar to switch between Fragments, and it does it this way: I want those Fragments to be static, so their content and views do not dissapear when I switch between them. I have tried to create them inside MainActivity’s onCreate() method, but it only helps with retaining text inside EditText widgets, the rest of the views
Tag: android-fragments
Activity does not have a NavController set on
I basically set up 3 fragments for my bottom navigation view with all linked to activity.xml activity.xml where I put fragment tag. My Activity.java code (specifically): The problem now is that if I run that same java code using fragment tag in xml, it runs well but suggests I use <androidx.fragment.app.FragmentContainerView(linters) but on using <androidx.fragment.app.FragmentContainerView, it displays the error in
Activity or Fragment for a SearchView?
I´m doing my final degree project and I have chose to develop and Android app using Firebase Firestore, the idea it´s cool because I´m learning how to program on Android, but on Java. So, I have develop the SplashScreen, Login form, SignIn form and able to connect succesfully with Firebase but right now I´m having a problem about thinking the
Getting onSwipe event from a nested RecyclerView to the parent Fragment
I’m developping an app in which my main activity hosts different fragments via a SectionsPageAdapter. My question is about one of those fragments that roughtly looks like the image bellow: My innerRecyclers lists differents items that I want to be able to remove by swiping and make the user validate the deletion via a DialogFragment. I was able to implement
Call method from Fragment in unselected tab
I have an application with tabs. I use ViewPager and TabLayout. In each tab I have a Fragment. When the tab is unselected I want to call a method from the fragment in that tab. If I want to call method on selected fragment i will do: based on the How to know Fragment id for the fragment(s) provided by
How to prevent activity to restart after changing its orientation
I’m new to android development using KOTLIN, i have activity that contain fragments like the image below (Image 1), the problem is whenever i try to change the orientation from potrait to landscape, the activity return to the previous activity (Like restart it). I’ve tried to add android:configChanges=”orientation|screenSize|keyboardHidden” to my AndroidManifest.xml, it works perfectly but some says that it’s not
ViewPager2 not working properly with Fragments and click events
I just wanna know if I’m doing something wrong since I’m kinda new to all this. If there is anything else that you’ll like me to add just let me know. This is the repo branch where I’m trying to implement the ViewPager if you wanna see all the code. Context So I have 4 Categories represented with Fragments, each
Get EditText input values and display some calculation result in an TextView
I have made a very basic weighted average calculator as Android Application (in Java) and it worked fine. The user just inputs 3 values a, b, c in three EditTexts and it calculates formula: Result of this mathematical equation is displayed in a TextView, all of this in the MainActivity at the press of a button. But after creating a
How to link a click handler to a fragment for data binding?
I want to use data binding in a fragment to trigger all my button clicks in handler class. When I run the code below I get the following error. I’m not sure if the problem is with how I’m passing the context to the Handler class or if I’ve done some wrong the Data binding. UserFragment MyClickHandlers fragment_user Answer Your
Passing data from a Pop up back to its Parent
The parent class activity consists of adapters and recycler views. Using one of the adapters the one click is set for images. If an image is clicked it opens a pop-up and the pop have some sliders and text fields. And the pop-up will collect data from users. Now I need this data, not in the adapter class but I