Questions tagged [fragmentmanager]

FragmentManager is an interface for interacting with Fragment objects inside an Activity in Android. While the FragmentManager API was introduced in HONEYCOMB, a version of the API at is also available for use on older platforms through FragmentActivity. For more information about using fragments, read the Fragments developer guide.

700 questions
3
votes
1 answer

How to make separate back stack for a fragment in Android

I have an activity that contains navigation buttons in separate fragment and FrameLayout. FrameLayout contains content fragment that represents one of apps categories(Timeline, Profile, etc.). Clicking to navigations buttons allows to switch between…
3
votes
3 answers

Strange behaviour replacing fragments in Android

I've been working for several months in an app. The version uploaded to the playstore works fine. Recently, doing some improvements, the whole app has started to work in a very strange way. If you swith between fragments, after a while it does not…
Adrian Latorre
  • 161
  • 2
  • 10
3
votes
1 answer

How can i remove all fragments that are added with the fragmentmanager?

I added multiple fragments like this : currentWebViewFragment = tabs.get(currentTabIndex); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.webViewFrame,tabs.get(currentTabIndex)); ft.commit(); But "If an activity is paused or…
DennisVA
  • 2,068
  • 1
  • 25
  • 35
3
votes
3 answers

Android - Fragments return to their first state after replacing them via FragmentManager

I have an activity that has 3 tab buttons and each of them will bring their own fragment into screen. And one of the fragmnets has a musicplayer and imagebuttons that changes their icons when i click them. ( like play button changes drawable to…
3
votes
1 answer

AppCompat v7: Should I use Framework FragmentManager or SupportFragmentManager?

I am making an app which should have minSdk = 15 and targetSdk = 21, therefore I want to use the features provided by the appcompat-v7 library. I always wondered if I should use getFragmentManager or getSupportFragmentManager when using the…
3
votes
1 answer

"Don't keep activities" - when app is restored the fragment is visible only for a second

I have an app that uses fragments. If I enable "dont keep activities", then enter the activity and enter the fragment, then minimize with the Home button and reopen the app the following behavior occurs - the app restores on the open fragment for…
Jon
  • 7,941
  • 9
  • 53
  • 105
3
votes
1 answer

Reload or notify Fragment's data in ViewPager

I have [main]Fragment with two ViewPagers in it. Each ViewPager contains several Fragments in it. ViewPager's Fragments obtain data into their ListViews from [main]Fragment. I need to update data in all ListViews, which comes from…
3
votes
2 answers

how to open different activities on clicking the items on navigation drawer?

I just start a new app and in beginning I select the navigation drawer option the eclipse IDE gives me complete code of navigation drawer and it is running as well . But after clicking its items it only increment the numeric value present in the xml…
3
votes
1 answer

List view reload when back pressed in fragment

I have Fragment XYZFragment where i display the list view.On the Listview item click i replace the Fragment like this. Fragment fragment=new XYZFragment(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft=…
3
votes
2 answers

android: getFragmentManager() returns null

Edit: The problem is that the fragment is getting detached from the Activity. However, I don't know how to prevent this. I have an application that uses a tab bar. When one of the tabs is clicked it loads a list of topics in the space below the tab…
LoneWolfPR
  • 3,978
  • 12
  • 48
  • 84
3
votes
2 answers

Hide fragment leaving empty space

I have a LinearLayout which has 3 containers (also LinearLayouts), and these have weight=1. Here is that layout:
nikmin
  • 1,803
  • 3
  • 28
  • 46
2
votes
1 answer

supportFragmentManager.findFragmentById returning null

The code I have posted below works when the activity is part of main app. However, when I import the project (of which the activity is a part of) as a library into another project and call the activity via startActivitiy() I have the null issue. My…
2
votes
0 answers

Fragment add exit custom animation not working working when fragment is Added Android

The custom exit animation works for replace but not for add getNavFragment() .childFragmentManager .beginTransaction() .setCustomAnimations( enter, exit, popEnter, popExit …
Sharan
  • 1,055
  • 3
  • 21
  • 38
2
votes
1 answer

Kotlin android app crashes because of coroutines

I'm developing my first app and learning as I go. The app communicates with a URL to fetch data, and sometimes to send data in a POST. Since my last gradle update to 7.1.1, my app is crashing when I open 2 different activities where such a…
sazira
  • 31
  • 3
2
votes
0 answers

No view found for id 0x7f0800be (com.example.progetto:id/fragment_container_view) for fragment HomeFragment{xx} (xxxx id=0x7f0800be tag=HomeFragment)

I've read these questions/answers: Android Fragment no view found for ID? No view found for id for fragment java.lang.IllegalArgumentException: No view found for id 0x1020002 (android:id/content) for fragment IllegalArgumentException: No view found…