45,567 questions
0
votes
1
answer
59
views
Android: How to change the FragmentManager Backstack when going back (insert a new fragment)?
I'm trying to add a view to the fragment stack, without any visible indication that it happened, so it appears when going back.
Forexample,
3 Fragments, A, B and C
A -> C
Then when going BACK from ...
1
vote
1
answer
184
views
Race condition with android fragment back stack changed listener?
I've got some code which looks like this in my main activity:
class MainActivity : AppCompatActivity() {
private val backStackListener = FragmentManager.OnBackStackChangedListener {
val ...
1
vote
0
answers
43
views
Android: App layout: floating bottom nav obscures fragment container
I'm trying to create this cool looking bottom nav where the fragment content "flows under it" as you scroll. Here's the screen, focus on the bottom: notice how you can see the content of the ...
2
votes
1
answer
76
views
Kotlin View Binding becomes Null outside liifecycle methods when returning from fragment
I have an app structured with one MainActivity and several fragments which are communicated with by some ImageButtons in this activity. In one fragment (UnreviewedFragment), I have a RecyclerView ...
0
votes
0
answers
53
views
Android BottomNavigationView overlaps list inside Fragment — how to add bottom spacing?
I’m having an issue with a Frame Layout inside a Fragment that also contains a Google Map and a BottomNavigationView.
Here’s my setup:
A BottomNavigationView is anchored to the bottom of the screen. ...
2
votes
1
answer
158
views
Jetpack Compose inside a Fragment: pass Fragment args directly to Composable or via ViewModel (SavedStateHandle)?
I’m migrating a Fragment-based app to Jetpack Compose incrementally. Some screens are still Fragments that host Compose with ComposeView. I recently changed a screen to pass a tabUid through Fragment ...
1
vote
1
answer
50
views
Cannot get rid of the unwanted color at the top of the screen (in the emulator) in Kotlin xml android
here is the code for the main page activity
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://...
-1
votes
1
answer
100
views
Edge to edge display [closed]
In a FragmentActivity, I try to set insets to correct the edge to edge appearance of my app. To do this, I copy the following code taken from Edge to edge display in my onCreate function :
...
0
votes
1
answer
38
views
Creating activity prevents spinner from spinning in Android
I have 2 activities in my app. When another one is called there is a spinner but it doesn't spin. I think it may be because the main thread is stuck.
I moved all background tasks to Dispatchers.IO, ...
1
vote
0
answers
33
views
Handle back pressed on fragment after rotating device
After rotating device my OnBackPressedCallback in Fragment doesn't performing.
I have tried to add callbacks to requireActivity().onBackPressedDispatcher in different lifecycle callbacks (onAttach, ...
0
votes
0
answers
73
views
RecyclerView IndexOutOfBoundsException with Paging3 and Selection Library (tryGetViewHolderForPositionByDeadline)
I am developing an Android app in Java that displays a grid of Japanese Kanji characters using RecyclerView with a GridLayoutManager. I'm using the Android Jetpack Paging3 library to load data from a ...
0
votes
1
answer
60
views
Wrong Android UI elements found after rotating phone when Biometric prompt is active
I am trying to deal with this new Landscape requirement nonsense. I also have this problem is also with a more complicated fragment but I noticed it happens with this as well and it is much easier to ...
0
votes
0
answers
74
views
How to structure google map so that it can be used in whole app android?
I am working on map project in android kotlin. i have one activity main and that implements the OnMapReadyCall back
MainActivity.kt
class MainActivity : BaseActivity(), OnMapReadyCallback, ...
0
votes
0
answers
48
views
How do we define the view model store to be used in a stand alone composable
I am trying to migrate the bottom sheet set up to use Compose. While I can use the Compose's ModalBottomSheet for this purpose,
I have the following questions:
My ViewModel's view store owner is the ...
0
votes
2
answers
59
views
How to handle application last most Activity/Fragment recreation after user revoked permissions through settings
I'm trying to understand whether it's a design problem or a technical one.
I've one Activity and two Fragments. Activity layout is just androidx.fragment.app.FragmentContainerView where a fragment is ...
0
votes
0
answers
32
views
Android 14 Attempt to get Photo and video permission after user has denied
I have the following code to get Photo and video permissions:
public void requestPhotoAndVideoPermissions() {
List<String> permissions = new ArrayList<>();
if (Build....
0
votes
1
answer
35
views
Navigation drawer not switch to Home Fragment
I've implemented Navigation Drawer in my project, and it seems to work, but when I navigate to another fragment, the menu stops working. I created a new one using the Android Studio template, libs ...
0
votes
0
answers
19
views
Last fragment is shown as a flicker when launched from a different application
The target activity uses singleTop as launchMode. When it is launched from another application with the following code, it shows Fragment A, then user switches to fragment B. Then user switches to ...
1
vote
2
answers
50
views
App crashing due to the constructor of the ViewModel threw an exception during its execution
I am developing my android app in kotlin which has a bottom navigation drawer and one fragment is contact fragment, in that fragment need the contact access and we can add that contact to emergency ...
0
votes
0
answers
104
views
CircularProgressIndicator with AndroidFragment bug
I have reported this as a bug to Google:
https://issuetracker.google.com/issues/422861653
But I figured I would get some good feedback here. The problem is that it looks like mixing an AndroidFragment ...
0
votes
1
answer
103
views
Android NavController shows last fragment before a different fragment requested from another activity is shown
SettingsLandingActivity holds multiple fragments and handles the transition in between them using NavController. When user enters the activity, it shows SettingsLandingFragment, as it is the default ...
1
vote
0
answers
44
views
How can I reference the attributes (x, y, height, width) of widgets from other fragments?
I am making an game in Android Studio using Java. There is a RelativeLayout in activity_main.xml called "top_bar", which contains elements like balance and progress bars (Energy, ...
0
votes
1
answer
55
views
What is the right way to instantiate a ViewModel inside a Tab Fragment and scope it to the parent navigation destination?
I'm using Navigation Component + Hilt DI. I have a Navigation Destination Fragment which hosts a viewpager with 2 fixed fragments. What is the right way to Instantiate the ViewModels within those ...
1
vote
1
answer
44
views
How to remove a fragment like terms and conditions and when accepting it, it does not appear again after restarting the app
I'm starting to make an application in Android Studio in Kotlin with fragments and I need, if possible, an example or help on how to make a fragment appear only once, for example, I run an application ...
0
votes
0
answers
67
views
Webview shows a blank screen when coming back from having the app on the background
I recently was tasked with creating a webview app at work. Everything works perfectly, except one thing.
When I put the app on the background, use the phone extensively (watch videos for example), and ...
1
vote
0
answers
48
views
Fragment leaked by androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation
I have Navigation Component (version 2.9.0) with androidx Fragments (version 1.8.6) and Predictive Back and androidx.transitions (version 1.6.0) with gesture navigation enabled. I'm seeing this leak ...
0
votes
0
answers
87
views
TalkBack not reading fragment content when replaced with addToBackStack in Android
I'm facing an accessibility issue in my Android app when replacing fragments with addToBackStack. When a fragment is added without addToBackStack, TalkBack reads it properly. But if I use ...
0
votes
0
answers
25
views
Android 14 FORGROUND_MEDIA_PROJECTION application crashing with targetSDK=35 requires permissions: .CAPTURE_VIDEO_OUTPUT ,project_media] [duplicate]
Process: org.fossify.phone.debug, PID: 4850
java.lang.RuntimeException: Unable to start service com.codewithkael.webrtcscreenshare.service.WebrtcService@bcad89c with Intent { act=StartIntent cmp=org....
0
votes
0
answers
107
views
Jetpack Compose TV: Card click not working after returning from long press + fragment navigation
I'm working on an Android TV app using Jetpack Compose inside Fragments.
Here's my setup:
I have Fragment A that contains a TvLazyColumn with multiple custom Card Composables (which wrap a Material3 ...
-1
votes
1
answer
54
views
How can i check the button state in recyclerview?
I'm currently working on an app. There are three fragments. One is the home page fragment where there's a list of some popular locations of the world listed in a RecyclerView. And the other one is the ...
0
votes
1
answer
52
views
Why does a recycler implemented into a fragment return "No adapter attached; skipping layout" when logging suggests otherwise?
I am trying to implement a custom calendar so I am using a recycler view. I have my main activity that I have programmed a navbar with to switch between fragments. This is set up using a nav graph.
...
0
votes
1
answer
39
views
Android (Kotlin): Removing a fragment handled by a custom handler from backstack
I'm trying to remove a fragment from a backstack, but LoginFragment is extended from BaseFragment, which is a custom fragment handler that I made instead of the usual Fragment used in Android ...
1
vote
0
answers
61
views
How to get application class methods from fragments or another activity?
In Kotlin declared variables in the application class can be accessed using the below code. How do I implement the the same in Java to be able to access that class variables and methods. Thanks a lot.
...
0
votes
0
answers
33
views
Testing failing because of java.lang.AssertionError: Activity never becomes requested state
I am new to instrumented tests and I am not able to have my very first test class to run. It is failing with this error:
java.lang.AssertionError: Activity never becomes requested state
"[...
0
votes
0
answers
53
views
Safe way to call findNavController.navigate/popBackStack during detached state
We recently got an exception where a findNavController.navigate() call was made from a fragment that seems to have been in the process of being destroyed, while another (the new/top one) was being ...
0
votes
0
answers
30
views
Drawer menu in android studio not "solid"
So for a school project we need to create an app with eco-house, and I got a problem its when I open the first time the drawer everything fine because header is "solid" and nothing goes ...
1
vote
0
answers
45
views
How to know if fragment is recreated after back press and popBackStack()?
I have a two fragments, A and B. Let say fragment A is a person form and B is a city searcher.
In fragment A, I query the database server for some data, and until I get this info I display a ...
0
votes
0
answers
77
views
Whenever I try to add a fragment to the start of my FragmentStateAdapter I get a 'java.lang.IllegalStateException: Fragment already added' error
I am trying to add a fragment to the start of a FragmentStateAdapter and it keeps throwing the IllegalStateException error saying that the fragment has already been added, however if I use the exact ...
0
votes
0
answers
53
views
how to make a dynamic bi-directional adapter for ViewPager2 in android
I am trying to make it possible for my users to click a post and scroll both up and down to newer/older posts and while scrolling down to older post is working just fine, when trying to implement ...
0
votes
0
answers
68
views
Efficiently track bounds of fragments of composables on the screen in android without onGloballyPositioned
I'm working on a multi-modal chat application where users send text requests, and the chatbot responds with text, images, and thumbnails. One of the requirements is to send context information about ...
0
votes
0
answers
10
views
Using nav graph xml from fragment to bottomsheet and from bottomsheet to fragment
I have code where I have FragmentA; from that Fragment, it redirects to BottomSheet, and from the BottomSheet I want to redirect FragmentB.
I'm using nav_graph.xml for the Fragments.
How can I archive ...
1
vote
0
answers
151
views
Android predictive back gesture if fragment is not first in backstack and needs to close app?
there're two fragments in backstack: A and B. In the B fragment there's simple back handler which will call finish() when back is clicked closing the app. I enabled predictive back gesture, how can I ...
1
vote
1
answer
48
views
How to send data from fragment present in a module to another Kotlin class present in another module
I am creating 3 edittext in fragment present in app module. Now there is another module in which Kotlin class is written to capture photos from camera. I want to send those 3 edittext inputs from ...
0
votes
0
answers
35
views
createFragment is not called in FragmentStateAdapter when Activity is recreated due to Configuration change
In homescreen it has a main activity, this has a main fragment. Main fragment uses viewPager2 to show widget screens. For 2 pages 2 instances of widget fragments are created.
When system language is ...
0
votes
0
answers
27
views
How to send images out of database from fragment to fragment in Android Studio using Glide
I try to send an image that is stored in the database from one fragment to the other.
In the first one (using a recyclerview) it gets displayed, but in the second one (normal fragment) it doesnt work ...
0
votes
0
answers
143
views
BottomNavigationView missing after implement WindowInsets listener
I try to implement window insets listener to listen keyboard show/hide on specific Fragment. It works well on the Fragment, but my Bottom Navigation is gone.
Here is my Fragment XML. I add android:...
0
votes
0
answers
55
views
Swipe through fragments in Navigation Drawer Views Activity
I can't get the swipe between fragments to work without recreating everything new.
I go to Android Studio and create a new project “Navigation Drawer Views Activity” Language Kotlin. This is what i ...
0
votes
0
answers
36
views
How to make the animation of android bottom navigation view icon not shaky when changing between features?
Shaky bottom nav icon animation I have this material bottom navigation view inside every fragment for each feature(plan, edu, therapy, profile):
<com.google.android.material.bottomnavigation....
0
votes
1
answer
2k
views
Android API < 35 full screen app confusion
I'm working on an Android app (home project) written in Java. I'm a casual Android developer and in order to achieve full-screen functionality I applied the same steps I successfully used couple of ...
0
votes
1
answer
60
views
How to add button to fragment toolbar?
I want to add a button here:
This menu is declared here:
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-...