279 questions
2
votes
1
answer
4k
views
Navigation Drawer + ViewPager + Fragments, ViewPager doesn't destroy nested fragments
My app has Navigation Drawer with two items: a ViewPager (inside a Fragment) and SupportMapFragment.
ViewPager use a FragmentStatePagerAdapter and getItem(int position) return two Fragments.
When I ...
19
votes
3
answers
8k
views
FragmentTabHost not creating view inside Fragment in android
I am having an issue getting the view to change on a tabhost - when I select a tab the content stays blank.
From what I can tell, onCreateView is not being called on the child Fragments. onMenuCreate ...
1
vote
1
answer
2k
views
How getChildFragmentManager() supports all API levels
When there is a need to use getSupportFragmentManager() to support lower API levels, I think using getChildFragmentManager() method. How this method supports all API levels?
6
votes
2
answers
3k
views
Nested fragment lifecycle
I have 4 fragments. I switch among them by using hide/show transactions. One of them may have nested fragments which are added by replace transaction. The issue is that if I add a nested fragment hide ...
0
votes
3
answers
1k
views
Android Fragments NullPointerException error
I'm trying to use the following code to open a Fragment that is inside another Fragment but is gives me a Null Pointer Exception with no cause.
Fragment newFragment = new SecondFragment();
// ...
0
votes
2
answers
889
views
Possible to retain state of child fragment when navigating back from another activity?
I have an activity that hosts a fragment A.
When fragment A is attached, I add a child Fragment B or C (depending on some flag) to a container in the A fragment.
Now if I navigate forward to a new ...
0
votes
1
answer
314
views
ViewPager doesnt show images in more than 1 Fragment
My app is a news app, with news listing fragment, NewsDetailsFragment (which contains menu, search, etc). I am using the single activity model and each screen is represented by a Fragment. ...
0
votes
1
answer
490
views
Android: FragmentPagerAdapter which includes multiple Fragments in same page
I have been looking for this all day. And I've have read through the Android Developer references aswell.
I would like the following structure in my xml.
<LinearLayout>
<fragment />
...
8
votes
2
answers
9k
views
ViewPager with multiple fragment instances of same class
I am trying to create a ViewPager which contains 5 fragments.
5 fragments "container", so each of them contain 2 fragments.
The 4 first fragments have the same layout and belong to the same class. ...
0
votes
1
answer
150
views
Nested Fragments, is it necessary to use support lib v4 even though I want to program for >13
I decided to make my app compatible with api level 13 and higher, so I can remove all the support libs and start using fragmentManager instead of supportFragmentManager etc.
However, now I realized ...
1
vote
3
answers
3k
views
getChildFragmentManager() method is undefined
I have the same issue has this post: android.support.v4.app.Fragment: undefined method getChildFragmentManager(). I need to use getChildFragmentManager() because I'm using nested fragments.
My ...
7
votes
1
answer
2k
views
ViewPager, getChildFragmentManager() & getFragmentManager()
I'm developing an android app, with TabHost & FragmentActivity in each tab.
In my first tab I initialize a fragment with a ViewPager indicator and a button,
this button open a dialog with another ...
2
votes
1
answer
677
views
SherlockFragment which contains SupportMapFragment does not open second time
In my app there is one SherlockFragmentActivity, whick has 6 fragments. One of these fragments contains map-fragment.
Problem : Now problem is when I launch an app the map loads successfully, but ...
56
votes
7
answers
95k
views
How to set a ViewPager inside a Fragment
I need to place a ViewPager inside of a fragment, but I have two fragments, Fragment 1 is my MENU, and Fragment 2 I want to use as a ViewPagerIndicator.
But a fragment can't have another fragment... ...
1
vote
2
answers
421
views
Commiting FragmentTransaction in 1 Tab of a FragmentPagerAdapter
I'm using FragmentPageAdapter to have multiple tabs within my app. 1 of those tabs is a ListFragment that is supposed to be replaced by another fragment onItemClick, using FragmentTransaction.
The ...
12
votes
3
answers
32k
views
Where to call getChildFragmentManager()?
Problem
According to the Google's docs:
You can now embed fragments inside fragments. This is useful for a
variety of situations in which you want to place dynamic and re-usable
UI components ...
2
votes
2
answers
8k
views
Unable to use getChildFragmentManager() in a fragment that was added to ViewPager
I have an app that is using ActionbarSherlock, SlidingMenu, and also ViewPager. This app works well but I am trying to introduce using Nested Fragment into the ViewPager.
Currently I have one ...
4
votes
1
answer
1k
views
Can't invoke getChildFragmentManager in Fragment
I am building android project with maven. But I found when I call getChildFragmentManager in v4.Fragment, it shows an error that this method is not found. I doubt that the support-v4 package is not ...
0
votes
1
answer
90
views
Adding a Tab with Fragments inside a Tab Fragment
I know my questions sounds like a tongue twister. Anyway I wanted to implement it but I don't have any idea on how to do it. I already know on how to use a FragmentActivity and add the TabHost for it ...
9
votes
1
answer
4k
views
ViewPager's Fragments disappear
I'm using DrawerLayout with ViewPagerIndicator, however the last won't work correctly with the DrawerLayout. Once I open the application, the viewpager is displayed correctly but once I change ...
0
votes
1
answer
2k
views
No view found for ID xxx for fragment (nested fragments)
I have an activity that has a ViewPager in the layout.
I have two fragments which display, one for each tab.
One of the fragments is designed to host other fragments - this is the ...
3
votes
2
answers
2k
views
Nested Fragment with backstack Resume
In my application there are several fragments in an activity and I am maintaining a backStack for these fragment. Everything is okay, but there is a nested fragment among them. When I put it into ...
16
votes
2
answers
19k
views
Adding a fragment to a dialog
I would like to add a fragment to a dialog (it can be either a DialogFragment or a regular Dialog). How do I do that?
Here's my DialogFragment:
public class MyDialogFragment extends DialogFragment {
...
0
votes
2
answers
570
views
Nested google map 2.0 fragment shows static picture
I have a problem with displaying google map fragment in view pager. I have an activity, viewpager in it, and in one of the fragments in viewpager there is a google map 2.0 fragment.
Fragment layout:
...
6
votes
1
answer
3k
views
Add fragment into a fragment (nested fragment)
I want to add a youtube fragment into my already existing fragments dynamically. The code I used is below:
// setting the Youtube Player Dynamically
private int setYoutubePlayer(String desc, ...
1
vote
2
answers
4k
views
How to add dynamic fragment in nested fragment with three pan layout
I am trying to build a three pane layout (three ListFragment). I am able to create it inside an activity by following layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:...
38
votes
1
answer
34k
views
Dynamically changing the fragments inside a fragment tab host?
I have one main activity which is fragment activity here I am setting two tabs with two fragments A and B in the B fragment I have one button when the user click on the button I want to change ...
1
vote
1
answer
344
views
Cannot replace a Fragment with a new one
I am trying to replace a Fragment inside another Fragment and I get a weird NullPointerException, could you please take a look and tell me what do you think?
Here is my code:
public class ...
3
votes
1
answer
2k
views
Display Two Fragments at the same time
From FragmentPagerAdapter in case 0 I instantiated fragment A this fragment I wanted to display display two fragments inside frag A. The view is not displaying. MyFragmentPagerAdapter is called by ...
2
votes
2
answers
2k
views
FragmentTabHost "Activity has been destroyed"
I have 3 fragment tabs, fragment1, fragment2, and fragment3. I have created another fragment tabs in fragment2. The problem is whenever I reselect fragment2 that contains fragment tabs, my app crashes ...
1
vote
3
answers
2k
views
Why can't nested Fragments use XML?
Googling I see many declarations that nested fragments cannot use XML. Now I am new to Android, but my app is using XML with nested fragments. I haven't got the listeners and interfaces working yet (...
4
votes
3
answers
6k
views
Fragments inside a fragment Android application
I'm trying to put 2 fragments inside a fragment. I found some code on internet but, as far as I could go, I don't succeed to put 2 fragments in 1 fragment.
I have seen tips dealing with ...
6
votes
2
answers
3k
views
getChildFragmentManager raise NoSuchMethod exception on 4.0.3 device but not on 4.2.2
I need to use nested fragments for my application and so I'd like to use getChildFragmentManager.
I have two devices:
A real one running on 4.0.3
A virtual one running on 4.2.2
It works pretty well ...
0
votes
1
answer
281
views
Fragment visible every second view in Viewpager
I'm currently trying to include 2 Fragments inside a Viewpager Fragment.
All works fine, but if I scroll 2 Fragments further and return to the one with the two fragments only the upper one is visible(...
4
votes
0
answers
1k
views
ViewPager inside Fragment doesnt show despite using getChildFragmentManager() when constructing FragmentPagerAdapter
I have a viewpager inside fragment. I would like to use FragmentPagerAdapter to swipe between fragments inside my viewpager.
public static class MyFragmentPagerAdapter extends FragmentPagerAdapter {
...
0
votes
1
answer
488
views
Replace a Fragment with a Layout containing a Fragment
What I'm trying to do is have a master/detail style app where one of my selector options is a Google Map with some extra buttons below the map layout.
All my other options just load a Fragment into a ...
1
vote
1
answer
758
views
Is Nested Fragment Possible?
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]
[...
2
votes
3
answers
4k
views
FragmentTabHost, Nested Fragments and ViewPager
I have an activity which makes use of a FragmentTabHost, so each tab has a fragment inside it. In the first tab, I have 2 nested fragments, one on the top half of the screen, the other on the bottom ...
1
vote
1
answer
1k
views
Viewpager Tabs Fragment
I have a viewpager in a fragment that works correctly on start up but if reload the fragment by replace() or replace with another fragment then load it again. The viewpager doesn't work correctly. I ...
53
votes
3
answers
13k
views
ViewPager in TabFragment is not loading a second time
I'm trying to make an app that has a ViewPager in a Fragment that is part of a TabHost. Everything works out fine. I have my tabbar, I can switch tabs. When I switch to the tab with the ViewPager, all ...
13
votes
4
answers
14k
views
How to create an Android Tabbed Dialog containing fragments?
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 ...
0
votes
1
answer
725
views
ViewPager with SherlockFragment always empty
Currently I have a tab host activity that contains SherlockFragment. In one of these tabs (Fragments), I want to implement a ViewPager that will show images (ImageView). I created a ...
1
vote
1
answer
196
views
Refreshing a fragment View on back from settings change
What I'm trying to accomplish is have my view refresh when someone comes back from the settings and changes their preference. I thought this would work but it is not. Any ideas on how i can accomplish ...
18
votes
4
answers
17k
views
Getting reference to nested fragment from FragmentTabHost
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 ...
2
votes
2
answers
13k
views
android.support.v4.app.Fragment: undefined method getChildFragmentManager()
I'm using ActionBarSherlock and ViewPageIndicator and I tried to implement nested fragments, but the method getChildFragmentManager() is undefined in myandroid.support.v4.app.Fragments.
There are no ...
115
votes
6
answers
76k
views
Best practice for nested fragments in Android 4.0, 4.1 (<4.2) without using the support library
I'm writing an app for 4.0 and 4.1 tablets, for which I do not want to use the support libraries (if not needed) but the 4.x api only therefore.
So my target platform is very well defined as: >= 4.0 ...
5
votes
4
answers
13k
views
How to show DialogFragment from Fragment in actionBar android
I use Tabs ActionBar with Fragments. Inside one fragment I have button. I want to show a DialogFragment (inside my fragment) when the button is pressed. How can I do that?
This is my code
public ...
9
votes
1
answer
4k
views
Lifecycle of a replaced ViewPager and BackStack?
I'm really messed up with the android ViewPager's lifecycle, and I'm starting to think that there something wrong in the structure of my app. So I would like a confirmation if I can do the following :
...
6
votes
2
answers
4k
views
Android FragmentTab host and Fragments inside Fragments
I have an app with hierarchy like this:
FragmentTabHost (Main Activity)
- Fragment (tab 1 content - splitter view)
- Fragment (lhs, list)
- Framment (rhs, content view)
- Fragment (tab 2 ...
113
votes
14
answers
117k
views
Getting the error "Java.lang.IllegalStateException Activity has been destroyed" when using tabs with ViewPager
I have an application that consists of using ActionBarSherlock in tab mode.I have 5 tabs and the content of each tab is handled using fragments. For tab2 though, I have a fragment the xml file of ...