android-nested-fragment

Where is getChildFragmentManager in support library v13?

偶尔善良 提交于 2019-12-03 11:20:54
Android support library v13 is supposed to provide support for newer APIs from Android 3.1. However, as far as I can tell there is no support for child fragments. Specifically, where is getChildFragmentManager()? The v13 support library relies on native fragments, which didn't add this method until API level 17. I have an app with minimum SDK level 14 so I should be able to use the v13 support library, but it seems I can't. I don't want to go all the way back to the v4 support library and take on all it's weight. The v13 library is perfect otherwise. If you want to use nested fragments within

NoSuchMethodError getChildFragmentManager()

可紊 提交于 2019-12-03 11:06:21
问题 I'm trying to implement a ViewPager with a FragmentPagerAdapter, where the ViewPager itself is located inside a fragment. I've read in the docs that it should be possible with the newest Support Library and by using nested fragments. Principally I would like the PagerAdapter to use the root fragment's child fragment manager. So, my project uses ActionBarSherlock and SherlockFragments. As the support lib bundled with ActionBarSherlock didn't include the method getChildFragmentManager() at all,

Child fragment gets destroyed for no good reason

こ雲淡風輕ζ 提交于 2019-12-03 07:56:26
Info: I have a 2 pane layout (2 child Fragments ) inside a ParentFragment , which, of course, is inside a FragmentActivity . I have setRetainInstance(true) on the ParentFragment . On orientation change, the left child fragment doesn't get destroyed ( onCreate() doesn't get called), which is normal (because of the parent retaining its instance). Problem: On orientation change, the right fragment gets destroyed ( onCreate() gets called). Why the hell is the right fragment destroyed and the left one isn't ? EDIT: If I remove setRetainInstance(true) , then the left fragment's onCreate() gets

Nested Fragments using support library v4 revision 11

折月煮酒 提交于 2019-12-03 06:01:14
问题 The last revision of the support library from this morning (Android Support Package v4 revision 11) is supposed to support nested fragments. In my project I have a fragment that contains a ViewPager and this ViewPager contains several fragments. I'm calling getSupportFragmentManager() instead of getFragmentManager to use the FragmentManager of the support library. The problem is I'm still experiencing crashes like : java.lang.IllegalStateException: Recursive entry to

Getting reference to nested fragment from FragmentTabHost

匆匆过客 提交于 2019-12-03 06:00:54
In my application, I use an Activity which holds one Fragment with FragmentTabHost and hence all its tabs are nested Fragments . Inside an Activity which holds a Fragment with its nested Fragment , we may get a reference to attached one using onAttachedFragment() . But how to get a reference to nested Fragment from FragmentTabHost ? Well, exploring the source code of FragmentTabHost I've found that when it adds a fragment tab, it assignes a tag of TabSpec to nested Fragment . So to get the reference to this Fragment we should call getChildFragmentManager().findFragmentByTag(tabSpecTag)

How to create an Android Tabbed Dialog containing fragments?

我的未来我决定 提交于 2019-12-03 05:56:32
Can anyone point me to an example or show me how to create a simple Tabbed Dialog in Android where the contents of each tab are Fragments ? All the examples/tutorials I have found are about Fragments and Tabs, but nothing specific to DialogFragments . The documentation for FragmentTabHost shows how to create tabs within normal fragments using getChildFragmentManager() . I'm assuming this should also work when the fragment is a DialogFragment but when I try it I get: java.lang.IllegalStateException: Fragment does not have a view at android.support.v4.app.Fragment$1.findViewById(Fragment.java

What exactly happens when Android recreates my app on an orientation change using nested fragments and getSupportFragmentManager()?

孤街浪徒 提交于 2019-12-02 18:06:28
问题 I've looked at other threads related to this issue and they all seem to use getChildFragmentManager() but if possible, I'd like to use getSupportFragmentManager(). Here is the issue: I have parent fragment A which holds child fragment B. B is a selector fragment. When the user makes a selection, B is "replaced" with C. So now A holds C. The user can also go back to B and open up a C displaying some other data, we'll call it C' . When the user goes back it is a "replace" transaction (not back

Nested fragments - Screen of Frag2 stays empty

帅比萌擦擦* 提交于 2019-12-02 12:09:32
问题 I'm suffering through nested fragments. I have a mainactivity which calls a fragment 1 which in turns call a fragment via a button. The fragment frag2 is well instantiated but the screen is blank. Is there something obvious with my code? MainActivity import android.app.FragmentManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

SupportMapFragment issue in nested TabHost Fragment

荒凉一梦 提交于 2019-12-02 09:56:42
I have 1 FragmentActivity 1 main fragment and 2 tabshosted child fragment one is for listview another for map. I have 2 problems here. First one is that I have to prevent recreation of child fragments on every tabchanges. Second problem; the first time I click tab for map fragment map can be seen. but coming back to list fragment and return to map fragment map is not being showed. I am really have trouble with this part in my project. I need your guide. My all code is as below. Main(Parent) Fragment public class MainFragg extends Fragment implements OnTabChangeListener{ private FragmentTabHost

Is Nested Fragment Possible?

早过忘川 提交于 2019-12-02 08:20:53
问题 I have a ViewPager contains three fragment, and I want to put 3 new fragments into the third fragment.Is that possible? [ViewPager] [Fragment 1] [Fragment 2] [Fragment 3] [Fragment 3-1] [Fragment 3-2] [Fragment 3-3] [ViewPager] EDIT: I can't getChildFragmentManager() but only getFragmentManager(), I'm using android.support.v4.app: FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.layout.tools_frame5, new Plugins()); ft.commit(); EDIT: what