Questions tagged [fragment]
**DO NOT USE**: fragment is an ambiguous tag, used to refer to numerous technologies. Prefer less ambiguous tags. For Android Fragments, use [android-fragments]. For URL fragments, use [url-fragment]
8,016
questions
0
votes
0
answers
10
views
How to pass data from android Tabs to Tabs with switching?
I'm trying to switch into second tab from first tab when first tab's recycler view item is get clicked. I also want to pass data from first tab to second tab.
When i do pass data using interface, my ...
0
votes
0
answers
26
views
Android. How to avoid fragment be recreated when back from another fragment?
I'm using MVP in my project. I have an activity. Inside this activity I'm showing fragment. Fragment contains some data, edit text, buttons etc. From this fragment it is possible to navigate to ...
1
vote
0
answers
8
views
Intent filter with navigation component to Receiving image data from other app
My Android application uses the navigation component to navigate between fragments.
And the project only has a single Activity and all the others are fragments.
My application is a social media ...
0
votes
1
answer
28
views
status bar becoming black and icon visible on swiping in Android api 30
I am using fragment and in that fragment i have ViewPager and in ViewPager i have added two fragments.when i open the app Everything works fine but my status bar becomes black and to see the icon i ...
1
vote
2
answers
32
views
send data from a fragment to an activity xamarin android
I'm sorry I'm using google translate.
I am trying to send data from a Fragment to an Activity with no success, the purpose of this is to update a TextView. I can't validate that the Intent brings the ...
1
vote
1
answer
54
views
How can Minecraft shader know about the objects when just pixels are the input
I know that Minecraft Shaders are written in GLSL. Someone explained to me that it would get a set of pixel as an input and would return a bunch of new pixels. But how does the shader know about ...
0
votes
0
answers
18
views
Local variable not restored on orientation change for fragments in backstack
I have two fragments, FragmentA and FragmentB, the user can go from FragmentA to FragmentB
Let's say FragmentA has a local variable varA. When the user is on FragmentA and changes orientation I can ...
0
votes
1
answer
22
views
Recycler View not displaying inside a Fragment
I'm using Recycler view to show items in my Fragment named Recent History. I want to display user data from firebase to my recent history Fragment. But the recycler view is not showing on the fragment....
0
votes
0
answers
10
views
Does anyone know a good way to make the initial fragment return when double-clicking on tab in bottomNavigationView?
Now i guess i can make it with views.bottomNavigationView.setOnItemSelectedListener and supportFragmentManager transactions. But i guess it is bad way for this realization.
Maybe there is an easier ...
0
votes
1
answer
26
views
i have a fragment contain List View, on a item click how to send position (int) to a new activity
i am creating simple counting app i create a main activity contain tab layout of two tab then each tab contain fragment on fragment i have a list view when and onitem clicked i like to stat a new ...
0
votes
2
answers
43
views
Set fixed height for bottom sheet dialog fragment in android
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:...
0
votes
0
answers
14
views
How to refresh fragment from activity on back pressed() function in kotlin android
I want to refresh listviews in the fragment, when i back press from activity. Where should i add refresh function in OnResume() or OnBackPressed() in the Activity
0
votes
0
answers
31
views
Why I can't send data from child fragment to parent fragment?
I have a parent fragment with 2 children fragments (home, detail).
Inside the parent fragment, there are 2 button to change both children fragment: btn_home and btn_detail.
When I click the button in ...
-2
votes
0
answers
19
views
Handle back button in android
I am fragment then I click to button I will transfer to another activity by using startActivity, then in activity I have a back button in screen, I want to back previous fragment. How can I do that in ...
-1
votes
0
answers
31
views
Nullpointer Exception on Appstart, because MainActivityBinding is null
When I try to start my Android Application, I run into a problem: My app starts but breaks down at runtime. The point of failure is setContentView(binding.getRoot());, as "binding" is null.
...
0
votes
0
answers
12
views
Is it ok to repeat fields in graphql queries?
query MyQuery {
capsules {
missions {
name
}
missions {
name
flight
}
}
}
Can I leave the above as is with no side effects?or should i change it to:
query ...
1
vote
0
answers
15
views
Filterable search not working inside recyclerview inside fragment
Question -
The main problem is when I run the app I don't see a filterable search working it always shows an invalid search even if I search the exact related text results.
The app doesn't crash as I ...
0
votes
0
answers
35
views
Youtube player animation with MotionLayout & ViewPager
I wanted to have animation just like Youtube app, when you click on any video, video plays in detail page and when you drag video down it sticks above bottom bar. (used motionlayout for implementing)
...
0
votes
0
answers
23
views
How to exit Viewpager2 or fragment
I using Viewpager2 to make a calendar app. click the menu button to display weekly and monthly calendar view. but I think if i click the menu button a few times to change the screen, All Viewpagers so ...
-2
votes
0
answers
22
views
Two fragments fragment A and fragment B belonging to different parent activity can share data via ViewModel?
Two fragments fragment A and fragment B belonging to different parent activity can share data via ViewModel?
0
votes
1
answer
55
views
What is difference between fragments and strict mode?
My question is apart from obvious difference, what are the main difference between fragment and strict mode?
0
votes
0
answers
10
views
Can FragmentResultListener used with the same request key in multiple fragments?
I have FragmentA(nav_graph_a), which navigates to FragmentB(nav_graph_b).
FragmentB navigates to a DialogFragment, which call setFragmentResult(RK_SHARED).
Both FragmentA and FragmentB registers a ...
0
votes
0
answers
5
views
Add pre selected keyword "hospitals" to show hospitals in map fragment
I am trying to create a Maps fragment in android, that, on load should show all the hospitals around my current location, I created the fragment in android that show the map only. I don't know how to ...
1
vote
1
answer
26
views
recyclerview is not showing data in fragment
I'm trying to get some data from firebase and display it in a recycler view in fragment
so i did created a methode that do that :
private void getModules(View view)
{
CollectionReference ref = db....
0
votes
0
answers
10
views
Go back to a Fragment from a PreferenceFragment
Code in the PreferenceFragment (android.preference.PreferenceFragment)
getActivity().getFragmentManager().beginTransaction()
.replace(R.id.container, new MyFragment())
.commit()...
0
votes
3
answers
48
views
How to open fragment from the click of the notification?
This is my onMessageReceived method. I am getting data from notification i want to open fragment when i click on this notification and get the data from this.
@Override
public void ...
4
votes
1
answer
388
views
'setHasOptionsMenu(Boolean): Unit' is deprecated. Deprecated in Java
How do I declare a menu inside of Android fragment? The method that I had used previously is now deprecated.
Originally:
override fun onCreateView(...): View {
setHasOptionsMenu(true)
}...
0
votes
1
answer
27
views
angular history route and fragment
my angular app use the history route path
localhost/blog/article/:id
when this route on open localhost/blog/article/123456, httpclient get some markdown content data and render
the markdown content
- [...
0
votes
0
answers
14
views
implementation of view-viewmodel pattern MVVM
I am new to development and I want to learn how to use the MVVM pattern. I have a problem with the fact that I need to implement the methods that I have in SignUpFragment in the ViewModel class. ...
0
votes
2
answers
50
views
How go to the Fragment page from activity using Intent
This is my Activity function that the startActivity(i) unable go to the Fragment page after scanning a barcode, I have try that it can go to activity page and show the code successful but I need it go ...
0
votes
1
answer
25
views
nullPointerException on calling getActivity().runOnUiThread{new Runnable inside Fragment
i'm trying to update my ListPreference summary inside my PreferenceFragment with timer
while i'm inside my fragment everything is fine but as soon as i press the back button my app crashes and it ...
0
votes
2
answers
42
views
Pass data between fragments and view pager2
I have a main fragment and two fragments in view pager (About/Reviews).
I call api to load data when navigation bar selected. I want to data model I have called api can be used between three fragments....
0
votes
0
answers
24
views
buttons in fragment(android studio)
I'm working on my app, and came to a huge problem. I need to implement buttons in my fragments and can't find a normal solution that works. this is the code:
package com.example.konjicdiscover10;
...
1
vote
3
answers
37
views
Recyclerview isn't quitely visible in CoordinatorLayout
I'm developing an app uses recyclerview for shownig the expenses of the user but I'm facing a problem that the content isn't being seen after scrolling below bottomnavigationview.
This image explain ...
0
votes
0
answers
26
views
Kotlin Recyclerview send data to fragment [duplicate]
I have 2 fragment, my BlogFragment has a recylerview , data taken from firebase is displayed in recyclerview.
I want to transfer the data in that row to BlogSayfaFragment when each row is clicked.
...
0
votes
0
answers
35
views
[Android]Error:"Can not perform this action after onSaveInstanceState" without using it
I'm a beginner with android and i have to create a simple app that handle a lessons book for students. Basically, sometimes i log out and crash with this error, sometimes not. I don't use se function &...
0
votes
0
answers
41
views
Fragment has null arguments
i have a problem. when i try to use safeargs to setText in my dialog EditFragment and then click my itemview it keep crash and show 'java.lang.IllegalStateException: Fragment EditFragment{da9aa86} (...
0
votes
0
answers
61
views
How to temporarily disable back Button/Navigation from Fragment in Kotlin?
I'm trying to temporarily disable the back navigation button in a fragment with Kotlin.
I got the following from StackOverflow...
val onBackPressedCallback = object : OnBackPressedCallback(true){
...
0
votes
1
answer
18
views
Android Studio Fragment with custom fragment class object
I just created a fragment in my app which consists of some controls. In principle, I want these controls to send their current data over a tcp client, which has a method TcpClient::sendMessage which ...
0
votes
1
answer
22
views
Navigating from one fragment via another via onClick, android
How do you navigate from one fragment to another, where one fragment extends the other? I want to navigate from the child fragment to the parent fragment via a button. Since the child fragment ...
0
votes
1
answer
43
views
Error parsing fragment to recyclerview in Kotlin
As part of one of my courses, I am using an API in Android Studio for the first time. For this I use OkHttp. However, I have the following error when I launch my application. I guess it's because the ...
0
votes
1
answer
33
views
NavHostFragment.findNavController throw: Method addObserver must be called on the main thread
I have another Fragment where this function work. But when i receive a response by the server the program crash and return this exeception. I'm new in android, so i don't really catch the meaning and ...
1
vote
1
answer
34
views
App keeps crashing when i try to load image
Please i have been trying this for weeks now. I have a fragment that displays notifications. But it time i click on the notification my app crashes. it points me the line below Picasso.get().load(user!...
0
votes
1
answer
40
views
Unresolved reference in findViewById when using Glide in Fragment in Kotlin
I am new to Kotlin. I have an "unresolved reference:findViewByid" when I am using Fragment. I try to add "view?.findViewByid", but the app crashed and val imgUniverse returns &...
0
votes
1
answer
89
views
Can't change the value of MutableList in a Kotlin class
I want to add the random generated integer into my MutableList in Player class when I use the random integer generator method located in Player class in my fragment then I want to pass this ...
-1
votes
1
answer
61
views
Kotlin can't add to or remove from the Arraylist
Hello I have a class and there is a method in this class.The method creates random int values and I call my method in my fragment in while loop.The problem is I'm trying to add those values to an ...
0
votes
0
answers
7
views
android studio when we connect our home fragment to activity [duplicate]
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Long com.google.firebase.firestore.QueryDocumentSnapshot.getLong(java.lang.String)' on a null object
explanation why coming ...
0
votes
1
answer
48
views
findNavController().navigate() being "ignored"
I am currently working on a Android-counter-app written in Kotlin.
On the apps startup, I'm fetching all the information needed on the start-up screen. From there, everything is sequentially being ...
0
votes
0
answers
37
views
I'm really tired , Interstitial ad show after the the fragment loaded
i have Activity MainActivity and use some Fragment.
i try the code in google developer and put the code ad in onAttach and onCreate but Interstitial ad show after the the fragment loaded
i worked in ...
0
votes
1
answer
48
views
How to setOnSeekBarChangeListener in a Kotlin Fragment
I am currently working on a mobile application in my uni classes that utilizes a seekBar to let the user decide to use a timer for a quiz. This application uses main to host all of the fragments. ...