I would like to create an Android app that uses a navigation drawer which loads different fragments, all of which include a toolbar/appbar and one that also has a TabView with ViewPager2, something like this: So I started a new Java project with Android Studio and chose the Navigation Drawer Activity template that creates 3 different fragments. This is my
Tag: android-fragments
Adding a ListView in a Fragment
I want to add a ListView to a Fragment. I created a FrameLayout in my activity_main.xml and then created 3 fragments (Home, Tags, Settings). What I did was create a bottom navigation view and created 3 frame layouts for the mentioned fragments. I searched the whole web on how to add a ListView to a Fragment, but whatever code they
Java OnClickListener not working in Android Fragment
I am trying to add a simple click on a button in a Fragment but the event is ignored. This is the code: I don’t know what is wrong in the code? Answer ok I have fixed this by using FragmentManager like :- for more details:- go to Android Studio – Fragment onClickListener not working
How can i listen for Fragment change in my Activity?
I have an Activity which based on intent opens Fragment1 or Fragment2. From the activity after some stuff are done if the user is in Fragment1 i replace the fragment to Fragment2 and that can be done even from the Fragment1 diretly. For each Fragment i have to change items in my BottomAppBar, till i’m in Activity i have no
How do I check if a field in another activity was filled? [closed]
Each user has its profile that is stored in a XML file linked to a Java class. But not necessarily they access this profile when they use the App, because they may just use the app without editing its …
when I click on the button the app crashes
Here the error: java.lang.IllegalStateException: Could not find method OpenRadio(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget….
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.
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 …
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 …
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, …