android-fragments

TabLayout ViewPager Not Loading When Using Backstack [duplicate]

百般思念 提交于 2020-01-31 11:07:05
问题 This question already has an answer here : Lifecycle of a replaced ViewPager and BackStack? (1 answer) Closed 4 years ago . I'm using a TabLayout in one of my fragments with a viewPager to switch between two fragments below the tabs. When I click the FAB inside one of the lower fragments, I load a new fragment (for input). However- when I press the BACK button, the TabLayout shows up but WITHOUT either of the lower fragments (represented by the pages). So what am I doing wrong? and is there a

RecyclerView in Fragment : No adapter attached skipping layout

荒凉一梦 提交于 2020-01-30 12:06:47
问题 I'm trying to use RecyclerView in Fragment, but I'm facing a problem, my list doesn't appear and I have this error: E/RecyclerView: No adapter attached; skipping layout I checked the solutions, apparently the problems appeared when: RecyclerView initialized after Adapter Bind and set recyclerView in onCreateView instead of onViewCreated But I gave attention, I tried alternatives and I'm still facing the same issue. Here is my code of the fragment: import android.databinding.DataBindingUtil;

RecyclerView in Fragment : No adapter attached skipping layout

∥☆過路亽.° 提交于 2020-01-30 12:06:46
问题 I'm trying to use RecyclerView in Fragment, but I'm facing a problem, my list doesn't appear and I have this error: E/RecyclerView: No adapter attached; skipping layout I checked the solutions, apparently the problems appeared when: RecyclerView initialized after Adapter Bind and set recyclerView in onCreateView instead of onViewCreated But I gave attention, I tried alternatives and I'm still facing the same issue. Here is my code of the fragment: import android.databinding.DataBindingUtil;

FragmentManager: No view found for id

最后都变了- 提交于 2020-01-30 10:41:55
问题 Edit I realized the issue was not solved, so I added the stack trace. This error occurs during Fragment transaction from an Activity. I read solutions for previous issues but couldn't find a relevant case. The transaction is done through a callback method from an Adapter. I'm doing it this way for the first time, so maybe something is off there. I can add the callback code if it's relevant. The final stack trace (the part that's paited red) E/AndroidRuntime: FATAL EXCEPTION: main Process: com

FragmentManager: No view found for id

断了今生、忘了曾经 提交于 2020-01-30 10:40:24
问题 Edit I realized the issue was not solved, so I added the stack trace. This error occurs during Fragment transaction from an Activity. I read solutions for previous issues but couldn't find a relevant case. The transaction is done through a callback method from an Adapter. I'm doing it this way for the first time, so maybe something is off there. I can add the callback code if it's relevant. The final stack trace (the part that's paited red) E/AndroidRuntime: FATAL EXCEPTION: main Process: com

FragmentManager: No view found for id

痴心易碎 提交于 2020-01-30 10:39:55
问题 Edit I realized the issue was not solved, so I added the stack trace. This error occurs during Fragment transaction from an Activity. I read solutions for previous issues but couldn't find a relevant case. The transaction is done through a callback method from an Adapter. I'm doing it this way for the first time, so maybe something is off there. I can add the callback code if it's relevant. The final stack trace (the part that's paited red) E/AndroidRuntime: FATAL EXCEPTION: main Process: com

Android: Add fragments by looking up container with tag instead of ID

泪湿孤枕 提交于 2020-01-30 08:19:26
问题 I am creating multiple instances of a fragment with a for loop. Within each fragment, I need to add another set of child fragments. In doing that, I need to find the correct container. If I use the ID of the container, all the child fragments gets added to the first parent fragment, instead of their own parent fragments. In my main fragment: for (....) { ParentFragment parentFragment = new ParentFragment(); parentFragment.setSomeData(data); fragmentTransaction.add(R.id.main_fragment_container

Android: Add fragments by looking up container with tag instead of ID

别来无恙 提交于 2020-01-30 08:18:26
问题 I am creating multiple instances of a fragment with a for loop. Within each fragment, I need to add another set of child fragments. In doing that, I need to find the correct container. If I use the ID of the container, all the child fragments gets added to the first parent fragment, instead of their own parent fragments. In my main fragment: for (....) { ParentFragment parentFragment = new ParentFragment(); parentFragment.setSomeData(data); fragmentTransaction.add(R.id.main_fragment_container

Preventing Fragment restoreViewState()

眉间皱痕 提交于 2020-01-30 06:00:31
问题 I have an object Foo which can be configured using a fragment ( FooFragment ). The Foo class contains a static reference to FooFragment and the method public Fragment getConfigurationFragment() ; this method assigns the current object to the FooFragment and returns it. public class Foo{ private static FooFragment fooFragment = new FooFragment(); public Fragment getConfigurationFragment(){ fooFragment.setObject(this); return fooFragment; } //various getters and setters } FooFragment is roughly

Preventing Fragment restoreViewState()

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-30 05:59:11
问题 I have an object Foo which can be configured using a fragment ( FooFragment ). The Foo class contains a static reference to FooFragment and the method public Fragment getConfigurationFragment() ; this method assigns the current object to the FooFragment and returns it. public class Foo{ private static FooFragment fooFragment = new FooFragment(); public Fragment getConfigurationFragment(){ fooFragment.setObject(this); return fooFragment; } //various getters and setters } FooFragment is roughly