Questions tagged [android-fragments]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

android.view.InflateException: Binary XML file line #25: Binary XML file line #25: Error inflating class fragment

I am working on a News App with fragments. the main error I'm getting is "java.lang.RuntimeException: Unable to start activity ComponentInfo{com.diparoy.newsexplorer/com.diparoy.newsexplorer.ui....
DIPA ROY's user avatar
0 votes
1 answer
18 views

Fragment's onCreateView(), onActivityCreated() recalled while navigating back using navigation component

I am trying to implement a navigation component into the Android app and noticed one issue while navigating back from one fragment to another fragment. Currently, I have 3 fragments (A,B and C) inside ...
Faldu Jaldeep's user avatar
0 votes
0 answers
18 views

Crash from Permission

I'm trying to take permission to change imageView with another image from library that users choose. So, I connected RecipesFragment with MainActivity with NavHostFragment.But when I try to run the ...
Alperen Avan's user avatar
1 vote
1 answer
23 views

Best Practice for Accessing a View in an Activity from a Fragment?

I'm seeking clarification on a fundamental concept. How do you best access a view that's in an activity from a fragment? Currently, I know of two methods: Using the fragment to call the activity's ...
Hugo Oliveira's user avatar
0 votes
1 answer
32 views

How to pop back to main menu activity in Kotlin

I have a main menu activity that the user can go into several different functions. When they click one, I move them to that activity and then open fragments. At any point, they can click Done to go ...
btorkelson's user avatar
0 votes
3 answers
41 views

How to get the SupportFragmentManager of a Fragment context in Android Studio

I was using the StoryView for my Chat project. Link- StoryView Github Since a recycler view is needed to show the stories, I also made a adapter. The fragment code of the storyview show- public class ...
Newbie_programmer's user avatar
0 votes
0 answers
19 views

Android bottom navigation issue with DeppLinks and multiple backstack

I'm implementing an application with bottom naviagtion and multiple backstack using latest android navigation component. My goal is to navigate between tow independent graphs using deeplink. App basic ...
cmpeguerog's user avatar
0 votes
0 answers
33 views

android.view.InflateException: Error inflating class androidx.fragment.app.FragmentContainerView

I published my application to the Play Store as open beta. I don't get any error when I run it with the emulator or by connecting the phone through Android Studio. However, when I install the ...
Mahmut Alperen Ünal's user avatar
0 votes
0 answers
24 views

Can I use react-native with window manager?

I know react-native can be used with fragment manager as in https://reactnative.dev/docs/integration-with-android-fragment How do I use the component in window manager though? Actually my main aim is ...
varun venkatesh's user avatar
0 votes
1 answer
23 views

More activities or 1-2 activities and multiple fragments? Jetpack compose or XML or both? [closed]

I'm building a simple app that's basically text input and multiple-choice input from a recycler view, pulled from an api. Then exporting the form answers to a pdf, uploading that to a database and ...
Daki's user avatar
  • 21
0 votes
1 answer
26 views

How to get appModule properties in feature modules

My project is having feature1Module and feature2Module. These 2 are included in app module build gradle file. implementation project(":feature1Module") implementation project(":...
G Anil Reddy's user avatar
0 votes
0 answers
22 views

Two similar bottom sheets but one needs childFragmentManager and other one parentFragmentManager! Why?

I accept that I am not master in fragment manager. But I expect that two similar BottomSheets behave similarly. I have a CustomBottomSheet (extend of BottomSheetDialogFragment). I have created a new ...
user21193451's user avatar
0 votes
0 answers
15 views

How to use NavController with a deeplink Uri and a Bundle of arguments

In short, I'd like to do this: void nav(NavController navController, Uri deepLink, Bundle args) { navController.navigate(deepLink, args); } However, androidx.navigation.NavController only has ...
Jordi's user avatar
  • 5,846
0 votes
2 answers
24 views

How to handle receiving null value from bundle

Hi I am passing a string to a fragment in a bundle and it can be null, but I am not sure how to accept null value when I read from the bundle argument companion object { private const val ...
BRDroid's user avatar
  • 3,962
0 votes
1 answer
20 views

Back to last fragment error since no addToBackStack Kotlin

sorry for my bad english I just update my gradle version and all my navigation become buggy, but I still not sure that this is the reason my navigation become buggy. this is my fragment handler on ...
Heru Prayogo's user avatar
0 votes
0 answers
11 views

When clicked EditText on any fragment foucs automatically changes to 1st fragment EditText in viewpager when same xml used for all fragments rendering

I have an XML layout which is used for rendering all the fragments dynamically in the view pager scroll view and in the fragment layout i have a Edit Text Box and when i click on the edit text in the ...
Hemanth's user avatar
  • 11
0 votes
0 answers
18 views

Android. How to correctly create DialogFragment?

I have custom DialogFragment, for example MyErrorDialogFragment, which can retrieve some data via arguments like: title, description: fun newInstance( title: String? = "", ...
testivanivan's user avatar
  • 1,008
0 votes
1 answer
35 views

How to correctly pass the MainActivity object to the fragment?

I can't figure out why the application is displaying null when the username (from user object) should be displayed. When I display through toasts in the MainActivity, everything is displayed correctly....
tyomnayark's user avatar
0 votes
0 answers
52 views

Jetpack Compose + Fragment using AndroidViewBinding: how to direct Focus back to side menu from the Fragment?

I am trying to create an app with Jetpack Compose on Android TV. The app implements a Side Drawer Menu, a Navhost and corresponding routes. One of the routes consists of a Fragment, which I have ...
YU No's user avatar
  • 69
0 votes
0 answers
23 views

Android Viewpager items gone invisible while the Fragment is started. But reappearing after locking and unlocking device

[N.B. This problem is from an old app; developed couple of years ago. Back then the app was working fine] Case 1: I was trying to show some SQLite data inside a fragment. (Extending Listfragment and ...
Rcktnm's user avatar
  • 1
-1 votes
1 answer
49 views

How to get fragment in another activity?

My project consists of the following structure. (Activity --> Fragments that can be attached) MainActivity --> Fragment A / Fragment B OtherActivity --> Fragment C / Fragment D Both ...
Haeiny's user avatar
  • 3
0 votes
1 answer
37 views

How to apply different toolbar(actionbar) layout for each fragment?

I am applying Single Activity Architecture, and I would like to use the top fixing bar using the toolbar. Within my project, the form of the toolbar varies from fragment to fragment, and the form is ...
Haeiny's user avatar
  • 3
0 votes
1 answer
27 views

Activity com.example.BasicActivity has leaked window DecorView@ec0c7fa[BasicActivity] that was originally added here

I have some problem, but i dont know what is causing this issue. Once I click on set as wallpaper button dialog disappear automatically even sometime setting a wallpaper taking long time. I try to set ...
Rohit Kumar Sehrawat's user avatar
0 votes
0 answers
20 views

how to fix a toolbar bag (Android, kotlin)

I have problem with backstack and toolbar. I have a singchat fragment and a user overlay. When I switch from the singchat fragment to the user overlay, I disable the mToolbar that is passed to all ...
insideggg's user avatar
-1 votes
0 answers
30 views

Chromecast Integration in Jetpack Compose: Resolving 'java.lang.IllegalArgumentException: background can not be translucent' Error

Method 1 (FragmentManager Issue): In my Composable function, I'm attempting to access the FragmentManager to manage Chromecast functionality. However, I'm facing difficulty in using the ...
micoder's user avatar
0 votes
2 answers
64 views

Compose not recomposing on state change

I have a compose UI for bottom sheet and I want to update the bottom sheet on data change. I am passing a state to the composable but its not recomposing on data change. private var title = ...
Shivam Gupta's user avatar
0 votes
3 answers
37 views

GridView Adapter duplicate the same list every once I leave the fragment and re-open it again

Recently I noticed a problem in my app when I close viewAllfragment and re-open it again, I see the list is duplicated again and again each time with the same data, I tried to clear the list when the ...
Dr Mido's user avatar
  • 2,438
0 votes
1 answer
21 views

How to close session in Fragment from click event that occurs in Activity

I've inherited a video playing app that I need to add analytics to. In my fragment I create the analytics object and this object then listens to and reports events and data. If the user clicks on ...
KoolKeith's user avatar
0 votes
2 answers
62 views

How to make Splash in Single Activity Architecture?

I need to create a splash screen in an application configured with Single Activity Architecture. It would be common to create a drawable file and set it as a theme, or to use the "splash screen ...
Haeiny's user avatar
  • 3
1 vote
2 answers
45 views

Memory Leak in Fragment due to infinite loop under lifecycle scope of coroutine

Description: I've encountered an issue in my application where the performance degrades over time and appears to be related to a potential memory leak. Here's the setup: Scenario: The main screen ...
Tousif Akram's user avatar
0 votes
0 answers
18 views

Can I integrate a navigation graph inside a fragment in my app with multiple fragments and a tab layout?

I am making an app which has 3 fragments tablayout. And in one of the fragments, I want to add navigation-graph. Is it possible to achieve this?
Hrithik Rajput's user avatar
0 votes
0 answers
27 views

Fragment fails to get view model after app was killed in the background and is navigated back to again

I can reproduce this crash by using "no background processes" from developer options or simply killing app process in the background. The crash happens when I navigate back to the app. This ...
qwertyFanatic's user avatar
-2 votes
0 answers
20 views

Communicate between activity and fragment

I want to send some data that I get from dialog in my main activity to a fragment with recycle-view. In summery I build to-do-list app with 3 fragment 1.all tasks. 2.active task 3.completed task. ...
ItamarAlmog's user avatar
0 votes
1 answer
23 views

How to replace fragments in ViewPager2?

I have a ViewPager2 with TabLayout in my android java application and it has 2 fragments AudioFoldersFragment and VideoFoldersFragment. Both fragments have a recycler view and have some items(folder ...
Rav's user avatar
  • 75
0 votes
0 answers
14 views

Android fragment creation takes much time

I need to make a fragment with hidden panel that can be shown on button click. My layout is a relative layout, main layout is shown by deafault, and the panel is centered and invisible. After adding a ...
Nikitiy's user avatar
  • 37
0 votes
0 answers
11 views

Fragment inside the FrameLayout is not loading

In the xml when I am adding the fragment tag inside a frame layout the IDE doesn't showing any view of the activity design is just goes blank. But when I am adding others layout like Constraint Layout ...
Sumita Das's user avatar
0 votes
0 answers
36 views

BadParcelableException when pressing "Recent Apps" button in DialogFragment

I am trying to make a DialogFragment which can be reused in different Fragments without creating a new one using the following code. All this code that I am going to put below works correctly, the ...
dimioLt's user avatar
  • 59
0 votes
0 answers
41 views

NullPointerException in getViewBinding

I have a fragment that uses viewbinding through eventhandlers. The eventhandlers are setup and taken down in onResume() and onPause(). In rare cases accessing the view through events results in a ...
mrbang's user avatar
  • 366
0 votes
0 answers
47 views

Using Fragments in Android Studio

I am trying to use fragments in my application, but something is wrong with them. The application doesn't even show anything. It starts and immediately shuts down. my mainActivity class: package com....
blacky's user avatar
  • 29
0 votes
1 answer
45 views

BroadcastReceiver onReceive() is not working on Fragment using Kotlin MVVM structure

I'm working on a app that capable of checking all bluetooth device and need to display it on recyclerview on load of the app. Im using BroadcastReceiver for the searching of the devices. but ...
FroyoDevourer's user avatar
0 votes
2 answers
36 views

How to use landscape and portrait layout?

I have an activity and several fragments(they are called fragmentA and fragmentB). Now fragmentA need to have both portrait and landscape layout. fragmentB have to keep portrait. The activity shows ...
Shiro Ennosuke's user avatar
0 votes
0 answers
14 views

androidx.fragment:fragment (androidx.fragment:fragment) has reported version 1.0.0 as outdated

androidx.fragment:fragment (androidx.fragment:fragment) has reported version 1.0.0 as outdated. Consider upgrading to one of the following versions before publishing a new release: 1.1.0+ how to fixed ...
Surya Prakash Rajbhar's user avatar
0 votes
0 answers
46 views

NullPointerException when accessing binding in Fragment after receiving JSON results

I'm having a problem with accessing the binding in my SearchAllFragment. It's returning a NullPointerException. Here's the flow: SearchActivity: When an intent with ACTION_SEARCH is detected, I ...
David Feldman's user avatar
0 votes
1 answer
23 views

Need to use handler.postDelayed returning from a DialogFragment using navigation component return with a boolean arguement

I am using Navigation component to launch & dismiss an ErrorDialog. I noticed that when I try to re-open the error dialog on a re-try flow I get an error that the action can't be found. It works ...
user1743524's user avatar
0 votes
1 answer
26 views

Decouple ViewModel from Fragment

How can I decouple a ViewModel from a Fragment? With Jetpack Compose, I could create a CreateEventScreen like this: @Composable fun CreateEventScreen() { val uiState = createEventViewModel()....
Eweries Lyricked's user avatar
0 votes
0 answers
10 views

In java, the adapter between fragments is reset and formed from the beginning

When the fragment is first opened, the information in it is visible, when I switch between the fragments and return again, the first fragment appears empty, I think the error is that the adapter is ...
shshdsjn's user avatar
0 votes
0 answers
16 views

How to inject the FragmentManger into interface in Android Fragment with Dagger Hilt?

I will show my sample code: interface ErrorDialogInterface { fun show(title: String) } class ErrorDialogImpl @Inject constructor( private val fragmentManager: FragmentManager ) : ...
anticafe's user avatar
  • 6,816
0 votes
0 answers
18 views

Disabling a spinner depending on the position of the other spinner

I am making some UI as an intern. however i ran into a problem, Note that im very new to kotlin. If i pick a program or "My part" in the first spinner then the second spinner should be ...
Tobias Søderholm Danielsen's user avatar
0 votes
1 answer
18 views

How to send data from one fragment to another using deeplinks?

I wanna open the screen with details of tasks by clicking on their titles. So I wanna send data(title and date and also descreption) to this screen. But I have an error required value was null. I don'...
0 votes
0 answers
12 views

how can I prevent getting focused on activity when the fragment is open on android tv?

I have an activity that plays a movie and there are many fragments that open over the activity. when the fragment opens over activity, the activity can get focused. I want the activity to no longer ...
sajjadshahbazi's user avatar

1
2 3 4 5
914