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,166
questions
0
votes
0
answers
5
views
I cant add onclicklistener on a constaintlayout
package com.example.nagaduserapp.Fragment
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import ...
0
votes
0
answers
5
views
Android LiveData re-observed twice when returning to fragment
This is the code from my Fragment:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
...
viewModel.myLiveData....
0
votes
0
answers
6
views
Android conditional remove fragment from back-stack using Navigation Components
In an Android APP I have the following navigation using Navigation Components and Nav Graph:
Fragment A -> Fragment B -> Fragment C -> Fragment D -> Fragment E
Anyway the back navigation ...
0
votes
0
answers
8
views
Android: Why Spinner.setSelection does not show correct value in the UI?
I have a Fragment (A) with a Spinner containing a list of years. From this fragment I can open Fragment (B) to get information about the year selected in the Spinner.
Moreover, from Fragment B I can ...
-1
votes
0
answers
8
views
I need to to select date from today & till next year same day, & remaining thing need to be disabled in android kotlin
val singleStartMonth = LocalDateTime.now(ZoneId.systemDefault())
payOnDatePicker = buildDatePicker(singleStartMonth)
private fun buildDatePicker(start: LocalDateTime): MaterialDatePicker {
val ...
-1
votes
0
answers
21
views
Replacing the fragment finishing the activity
public void onClick(View v)
{
if (v == mapViewButton) {
try {
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, new MapViewFragment ())...
0
votes
0
answers
12
views
Second Fragment goes to background and open same activity with first fragment. Upload image using webview
I have one activity name is Profile activity. In this activity added one fragment name is my information fragment. Now I am calling second fragment which is contain webview with document upload ...
0
votes
0
answers
9
views
Overriding SoftInputMode in fragment not working
I have defined windowSoftInputMode="adjustPan" in Manifest activity tag and want different softInputMode in different fragment. Here is my code:
AndroidManifest.xml
<activity
...
2
votes
0
answers
90
views
+50
Fatal Exception: java.lang.IllegalArgumentException: No view found for id In AndroidViewBinding Jetpack Compose
I am loading a fragment inside Jetpack Compose AndroidViewBinding as shown below,
val fragmentManager = (LocalContext.current as? FragmentActivity)?.supportFragmentManager
AndroidViewBinding(
...
0
votes
0
answers
18
views
How to get Experience Fragment component data as json in page level
I've a page with multiple components and all the components have @Exporter annotation and data is exporting as json, but header and footer components are added as Experience Fragment, when hitting ...
0
votes
0
answers
26
views
Using a Singleton to fix BottomNavigationActivity removing Fragment on navigation
BottomNavigationActivity as well as NavigationDrawerActivity removefragments on navigation and don't add them to the Back Stack. Therefore one has to rebuild the view from scratch on each fragment ...
0
votes
0
answers
13
views
Android binding not working with fragments
I'm following the official documentation on how to do the binding, but no success with the fragments. The app receives data from a server and displays it in different views in a fragment, but nothing ...
0
votes
0
answers
25
views
Fragment not attached to a context issues
when I use the requireContext() method in the fragment, sometimes long operations occur. This error occurs when the user suddenly closes the application or moves to another page. What solution should ...
0
votes
1
answer
50
views
my app crashes when I using navigation component
when I start using navigation component the app crashes . it can`t inflate correctly the fragmentContaner view.
the main activity kotlin
package com.example.task2
import androidx.appcompat.app....
0
votes
0
answers
32
views
Why Fragment's onCreate is called multiple times only for the first launch after install via Android Studio?
When I install my app on my phone through Android Studio, I face a strange problem.
I have a SplashFragment in my MainActivity that is the start destination of my nav_graph. In MainActivity I have a ...
0
votes
0
answers
10
views
How avoid the backstack entries in dialog fragment
am using the viewpager in order show the frgment with dynamic data , whenn the particular time opem the dialog the exiting support fragment manger back stack entry cleared and created the new back ...
0
votes
1
answer
24
views
Android Dialog not inflating view?
In an Android App, I have a list of multiple entries, that should be editable. Since every entry is made out of multiple values, i've created a fragment that basically represents the edit-form.
When ...
0
votes
0
answers
45
views
Angular 16 anchor scroll troubles
I have a web app in angular 16 with home page with menu and several components inside which contain an id as anchor. What I want is to reach one component in the home page by clicking on a menu item.
...
1
vote
1
answer
46
views
I cannot navigate correctly in the bottom navigation bar - android bottom navigation view
There are 4 fragments in my application and 3 icons in the bottom navigation bar. When I press a fragment that is not in the bottom navigation bar, the navigation structure breaks down.
First, when I ...
0
votes
0
answers
24
views
How to insert one thymeleaf fragment to another?
Now I'm working with html on my spring-app, and decided to use th:fragments and th:layouts, because I'm tiered to cope/paste one code in each .html I'm creating. And its works accept on little thing - ...
0
votes
0
answers
19
views
Tabs Focus Behaviour problem by fragment next focus up on tab layout
I have Home, Movies, Live TV, TV Guide, Apps & Games Tabs and on every click on tab I open fragment which contains multiple rail like Bollywood Movies Rail and others rail also and when I press up ...
0
votes
1
answer
50
views
Back button handling Android
I am pretty new in android development and Kotlin. I created a navigation bar which is implemented this way in Kotlin programming language:
flScreen = findViewById(R.id.flScreen)
bnvNavigation = ...
0
votes
0
answers
28
views
Fragment Output Interface incorrect?
I'm new to vulkan and setting up a graphics pipeline right now. I'm following this tutorial series.
So VUID-VkGraphicsPipelineCreateInfo-alphaToCoverageEnable-08891 is the error I'm getting and I don'...
0
votes
0
answers
18
views
Flutterfragment does not get ChangeNotifier updates
I am using FlutterFragment to host a flutter fragment inside the android studio. That's it, flutter opens an android activity (map screen) that in turns hosts a FlutterFragment (a simple Bottomsheet). ...
0
votes
1
answer
20
views
FragmentManager has not been attached to a host because it was null after calling getSupportFragmentManager
I am working on an App that will have a single activity and multiple fragments.
The flow will be:
MainActivity with a fragment container.
The initial fragment will have 4 textview buttons to display ...
0
votes
0
answers
56
views
Trouble with showing data from database on a fragment
I want to show my user name from database to the fragment. I get the data from Firebase on MainActivity and then pass that data to my target fragment. When I start the app, the fragment doesn't show ...
0
votes
0
answers
12
views
printerInit(PrinterName: String) throw Exception Message : Fragment WebViewFragment not attached to an activity
I have created an AAR library which contains my printing code. I also have an application which has main activity and a Fragment in it. Fragment from Main Activity initializes my printing module and ...
2
votes
0
answers
54
views
creationExtras.get(APPLICATION_KEY) always returns null
I'm trying to make viewModel with dependencies and Application app = (Application) creationExtras.get(APPLICATION_KEY); always null,
That means i can't to get any dependencies, like Context or my ...
0
votes
1
answer
19
views
Change Activity to Fragment
I started a project using Activity however now I need it to be a Fragment because I want to use a Bottom Navigation Bar. How do I go about doing this? I'm new to Android development and I'm stuck. Any ...
0
votes
0
answers
15
views
Ionic 7 Anchor Fragment
I cant get the routerlink/fragment to work.
Does anybody had any luck or am I just doing it wrong?
<ion-button [routerLink]="['/about/']" fragment="make">Add account</ion-...
1
vote
1
answer
92
views
Blank Fragment shown on activity restart/config change in compose TabRow
I am trying to implement TabRow in compose with existing fragments being shown in FragmentContainerView. When the child fragments are added to the activity/host fragments they work fine. But upon ...
-1
votes
1
answer
59
views
Fetching navigation menu items inside a liferay fragment
I am working on a custom fragment in liferay 7.4 and I would like to fetch the navigation menu items in the fragment to use them as list items in my html component. The problem is, I used the headless ...
0
votes
1
answer
12
views
viewpage contain fragment ,the fragment contain a inner viewPage, i found viewPage can`t skip when the fragment hide and inner viewpage don`t move
viewpage contain fragment ,the fragment contain a inner viewPage, i found viewPage cant skip when the fragment hide and inner viewpage dont move the lastest page.The out viewPage event has been ...
0
votes
0
answers
18
views
FragmentTransaction.add() issue while setting parameters for ContainerView and Fragment Class
I have tried to import android.support.v4.app.Fragment, but it doesn't allowing me to import that.
This is my MainActivity
enter image description here
package com.example.saveload3;
import android....
0
votes
0
answers
22
views
Kotlin, Fragments, not working, but no errors
Im currently an intern at Spin Robotics in Denmark.
And therefor ive also been thrown in to unfamiliar grounds in terms of skills.
I was working with getting to knowing Kotlin the first week. like ...
0
votes
0
answers
23
views
how to resize a button programmatically in a fragment
I'm struggling to resize 2 buttons in my fragment which I created in the java file.
My Code:
protected Option[] options = {
//new Option(),
new Option(R.drawable.male_transparent, R....
0
votes
0
answers
26
views
File not deleted Android
I want to delete file from specific folder
I have this code in a fragment
val file = File(Environment.getExternalStorageDirectory().absolutePath + "/" + Environment.DIRECTORY_DCIM + "/...
0
votes
1
answer
92
views
How to open from android Java Fragment a Jetpack Compose Dialog
I have legacy fragment code, and I need to open from fragment Dialog which is written as composable:
I have such class:
class FullScreenDialogActivity
@JvmOverloads constructor(context: Context, attrs:...
0
votes
0
answers
53
views
In the Google Play Console, there is a report of Crashes and ANRs that contain an error related to "androidx.fragment.app.q."
I recently migrated my Android app to Kotlin, and after the migration, I started encountering a persistent error in Google Play Console Crashes and ANRs. The error message indicates "androidx....
0
votes
1
answer
25
views
i m trying to get permission of gallery and camera from the user and want to show that on the profile fragment
trying to get permission from the user of gallery and camera want to display that on the fragment but getting resultCode -1 and even cannot get the onRequestPermissionResult code there. Getting the ...
0
votes
2
answers
46
views
How to start TabLayout with second item ? (In Android, on Fragment, using Kotlin)
My Android app works perfectly. Fragment with TabLayout starts at first item and works as I need.
But now I need to start Fragment with TabLayout from second item. And then I ran into problems.
I ...
0
votes
2
answers
95
views
What is the difference between overriding lifecycle methods of activity or fragment and adding a LifecycleObserver to its lifecycle object?
I was reading developer.android documents (this page) and encountered this paragraph : "Do not override lifecycle methods such as onResume in Activities or Fragments. Use LifecycleObserver ...
0
votes
0
answers
21
views
cannot cast 'androidx.fragment.app.Fragment' to 'com.google.ar.sceneform.ux.ArFragment'
Inconvertible types; cannot cast 'androidx.fragment.app.Fragment' to 'com.google.ar.sceneform.ux.ArFragment'
Here is my code:
I have import com.google.ar.sceneform.ux.ArFragment;
but still get an ...
0
votes
2
answers
38
views
How can I observe Activity Live data class in Fragment Kotlin
I have been trying to observe this code in a fragment but I am not getting it. If I use it on a normal activity it works but on fragment it brings errors.
class HomeFragment : Fragment() {
private ...
0
votes
1
answer
24
views
How do I open an URL from a RecyclerView in a Fragment in Kotlin?
I have a list of items in a RecyclerView that is in a Fragment, and I am trying to make it open an URL by clicking on a certain item. For example, if I click on the first item, it should redirect me ...
0
votes
0
answers
14
views
MyAdapter and ArrayAdapter issues in Fragment
Here are my codes:
MyAdapter adapter = new MyAdapter(this, n,s,t,image);
list_view.setAdapter(adapter); //my other problem
ArrayAdapter arrayAdapter = new ArrayAdapter<String>(this, ...
0
votes
1
answer
70
views
FragmentPagerAdapter is deprecated problem
Android Studio says fragment pager adapter is deprecated.
How can I remove this error? here is the screenshot
public static class ViewPagerAdapter extends FragmentPagerAdapter {
private ArrayList&...
3
votes
2
answers
333
views
Navigation from a destination to another destination in another navigation graph in Android Kotlin
I'm new at navigation graph and I have a simple movie application that contains a BottomNavigationView with 2 tabs or 2 icons , the first icon or first tab contains 2 Fragments the first one is ...
0
votes
1
answer
78
views
Is there anyway to show fragment preview of navigation.xml in Landscape?
Is there any way to show the fragment previews in navigation.xml in Landscape?
I wanted to use navigation.xml to show what are the current navigation between different fragments of code, however the ...
0
votes
0
answers
169
views
How do I set up ExoPlayer in a Fragment?
I'm having trouble figuring out how to use ExoPlayer when in a fragment. It appears like the video player is set up, but nothing happens when I click play.
My guess is that it has something to do ...