45,515 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Best practices
0
votes
1
replies
66
views
How to update NavigationDrawer selected item when navigating from a Fragment?
I would like to move navigation logic from MainActivity to MainFragment. However, when navigation happens, I also need to update the selected item in the NavigationDrawer, which is defined in ...
- reputation score 161
Score of 0
1 answer
106 views
Android 15/16: returning from browser (deeplink) causes mixed DayNight theme in fragments (new fragments use system dark, old fragments stay light)
I have an Android app using AppCompat DayNight (Theme.MaterialComponents.DayNight.NoActionBar).
Goal
First run: app should follow OS theme (optional).
After user manually selects Light or Dark, the ...
- reputation score 31
Score of 0
0 answers
64 views
Android "Fragment already added" despite smart fragment management
I thought my code works well in terms of fragments management because I have tested it manually for a long time. Besides Crashlytics also didn't notify me that users are having any problem with it for ...
- reputation score 149
Score of 0
0 answers
78 views
CameraX/Camera2 API + PreviewView does not show the same field of view as equivalent zoom in default Camera App
I can't seem to figure out why utilizing a the Camera2 or CameraX API (backend) with a PreviewView element (frontend) as a viewfinder for the camera doesn't seem to show the same field of view as the ...
- reputation score 43
Score of 3
1 answer
190 views
Fragment visibility issue: PlaylistsFragment shows blank screen after navigating back from child fragments
I have an audio player app, it's contain a PlaylistsFragment that contains 4 cards which navigate to other fragments (FavouritesFragment, RecentlyPlayedFragment, MostPlayedFragment, ...
- reputation score 3049
Score of 3
0 answers
144 views
Fragments, Predictive back animation customization
To implement Predictive Back feature in an app, that uses Fragments and Navigation Component, there are 2 options:
Option A: Use Transition API.
Just set animator animations directly into nav_graph ...
- reputation score 51
Score of 0
1 answer
82 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 ...
- reputation score 759
Score of 1
1 answer
210 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 ...
- reputation score 16321
Score of 1
0 answers
52 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 ...
- reputation score 273
Score of 2
1 answer
89 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 ...
- reputation score 23
Score of 0
0 answers
73 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. ...
- reputation score 121
Score of 2
1 answer
245 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 ...
- reputation score 87
Score of 1
1 answer
54 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://...
- reputation score 21
Score of -1
1 answer
116 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 :
...
- reputation score 1830
Score of 0
1 answer
42 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, ...
- reputation score 1