Fragments represent reusable behaviors or portions of user interface in an Android app.

learn more… | top users | synonyms

9
votes
0answers
589 views

android lollipop animation glitch

I have a strange behaviour with the default layout animation in devices running Android 5 (Lollipop). I am using an activity with multiple Fragments which are replaced at runtime using the default ...
6
votes
0answers
780 views

“Could not find class android.transition.Transition” exception when pressing back button

I have one activity that hosts one fragment at a time, and swaps between two fragments. Fragment A starts Fragment B using a button, and Fragment B starts fragment A either using a button or the back ...
5
votes
0answers
480 views

Odd logcat error when switching to new fragment

I haven't encountered a stack trace such as this. It's particularly weird because I can only get the error to be thrown when debugging. (Running the app without debugging does not yield this error). ...
5
votes
0answers
941 views

Google Analytics v4 - Data not showing on dashboard

I've been working on integrating Google Analytics v4 into my application. I've followed this : https://developers.google.com/analytics/devguides/collection/android/v4/ however, my analytics dashboard ...
5
votes
0answers
843 views

android libvlc multiple surface problems

I would know if is possible to use two surface in same layout and view each at same time. In future I would a grid-view of video-view, but each video-view using vlc. I modify this sample ...
4
votes
0answers
203 views

Android fragment transition with shared element

everyone! I have 2 fragments. In one fragment i have a little image in card. In 2d fragment i have the same image in the header of my layout. I want to make shared element transition of this image ...
4
votes
0answers
2k views

No adapter attached; skipping layout error

I'm developing Android application that must show all images stored inside SD card. I did it successfully except I getting strange behavior when switching to landscape mode (in fact, I do not see ...
4
votes
0answers
297 views

Fragments not appearing in the ViewPager when using PagerSlidingTabStrip

I am developing an Android application that has an SlidingPaneLayout, in which in the left pane I have a ListView with items that are being loaded to the right pane (after a click). In the right pane ...
4
votes
0answers
342 views

Horizontal and Vertical ViewPager together

I have a list of items (custom objects). This is the main list. Each of the item in the list has another list of data (URLS). This is the sublist. I want to show the data from main-list implemented ...
4
votes
0answers
605 views

Child fragment in View Pager Fragment disappears after swap

So this is a bit of a complex question, but I will try to make it as easy to follow as possible. To start, I have a main activity with a view pager. There are 2 pages in it, with 2 actionbar tabs ...
4
votes
0answers
151 views

How to use LoaderManager.LoaderCallbacks and CursorLoader for ORMLite?

Recently I started using ORMLite for my application. Before I used to use 'ContentProvider' and implement LoaderManager.LoaderCallbacks<Cursor>. I would create CursorLoader and show the list to ...
4
votes
0answers
228 views

android partial fragment -> swipe to see whole fragment

I want to do something like what the new google map on android does, if you type in an address, tap the marker, it'll show you a partial detailed view : ...
4
votes
0answers
292 views

How to implement multiple cordova webviews in an Activity using fragments?

I’m trying to build an android app using phonegap with several Cordova webviews. Now in order to do that, I’ve tried to create a FragmentActivity that implements CordovaInterface. However, the Cordova ...
4
votes
0answers
2k views

java.lang.IllegalStateException: Failure saving state: active has cleared index in fragment

First, my app has structure like this: SpashActivity -> MainActivity -> switching between many fragments My app use SlideMenu to switch between fragments. I have to use attach instead of ...
4
votes
0answers
3k views

ObjectAnimator onAnimationEnd listener is called before the animation finishes

its weird and strange, but it seems like when I attach an AnimatorListener to an ObjectAnimator I use for animating fragment transactions, the callback gets actually called slightly before finish of ...
4
votes
0answers
130 views

Stop dpad focus going outside current fragment in android

My current app requires control using a D-Pad remote. Using Focus/Select, automatic calculation of nearest neighbour works as expected but i want to limit the Up, Down, Left, Right movements to only ...
4
votes
0answers
713 views

Show MapFragment in a DialogFragment

I'm new with android development and i'm working on a app where i need to use google map to select event position and i need to show this map like a popup windows , i see this post : MapFragment in ...
4
votes
0answers
1k views

HorizontalScrollView in TabHost adding extra space on the end

In order to easily switch between fragments, I'm embedding a HorizontalScrollView into my Tab layout like so: <?xml version="1.0" encoding="utf-8"?> <TabHost ...
4
votes
0answers
1k views

How does `onViewStateRestored` from Fragments work?

I am really confused with the internal state of a Fragment. I have one Activity holding on Fragment at once and replaces the one, if another Fragment should get shown. From the docs ...
4
votes
0answers
198 views

Android adding fragments at runtime causes flicker

I have a main activity with content - a WebView. Basically, when the user opens the application, I do a quick check if they are logged in. If they aren't logged in, then I inflate the login ...
4
votes
0answers
854 views

swapping fragments by hide and show with slide transition causes both to vanish

I'm trying to animate the transition between a pair of fragments using transaction.show and transaction.hide to swap fragments. I thought it would be simpler than using replace as I understand this ...
3
votes
0answers
54 views

YouTubePlayerSupportFragment with navigation drawer and getting Error YouTube video playback stopped due to unauthorized overlay on top of player

I wanted to impement YouTubePlayerSupportFragment with navigation drawer but i m getting error YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is ...
3
votes
0answers
213 views

NullPointerException: int android.support.v4.app.FragmentManagerImpl.mCurState null object reference

I've updated my app with Android L and i have this exception i can't understand: NullPointerException: Attempt to read from field 'int android.support.v4.app.FragmentManagerImpl.mCurState' on a null ...
3
votes
0answers
100 views

Aviary for Android - How to force crop image using editor.launch

How can I force crop image using Aviary for Android. ? When I take a picture, the aviary editor will be called, then I need to force crop the image as Square. here is a sample for the web. I need to ...
3
votes
0answers
258 views

Google Maps Android API v2 blocks UI thread

Inside FragmentActivity I replace Fragment which has nested TabPageIndicator (2 tabs inside). First tab - Fragment with Description. Second tab - Fragment with map inside + markers! When I start ...
3
votes
0answers
116 views

Dynamic Center Aligned ViewPager

I'm having trouble aligning the fragments to the center of the view pages, in a way that the user can see multiple fragments on the screen. This problem has already been solved before, but not when ...
3
votes
0answers
212 views

How to refresh Child fragment in nested Fragment inside of view pager?

How to refresh Child fragment in nested Fragment inside of view pager ? Hi, i want to refresh my current fragment, i have folow this concept and logic in my project structure, ...
3
votes
0answers
137 views

Add icons to tabs adapter which extends FragmentPagerAdapter

how can i add icons in tabs instead of title in tabs adapter which extends FragmentPagerAdapter in android ? i don't want to use action bar in my project any help please ?? public class ...
3
votes
0answers
166 views

Cant inject null value into class

I have a fragment that I want to reuse. Its functionality is the same, only the layout changes I am using roboguice to inject views by id into the variables I added this view for example: @Nullable ...
3
votes
0answers
84 views

Somewhat laggy (stutter) ViewPager when XML file contains imageviews

I have a ViewPager that has a new Fragment for each page. I made a fragment to test out my ViewPager, this fragment has an layout that looks like this: <LinearLayout ...
3
votes
0answers
41 views

Comparison of ways to pass data to Fragments

I know of a few different approaches to getting 'stuff' into a Fragment, but in some cases I'm not confident I've rooted out all the 'devils in the details' and I haven't found a way I'm really happy ...
3
votes
0answers
50 views

Manually load the fragment in FragmentActivity

I want Horizontal as well as vertical swipe using the ViewPager.I implemented it using the Vertical view pager in which I used the fragments for the vertical swipe and in that fragments, used ...
3
votes
0answers
55 views

view is not getting inflated after a fragment is added on the framelayout

I have a strange problem, i placed my layout files in layout-large-land(landscape mode) folder and and added a fragment on button click... that fragment is correctly inflated , but if i try to add ...
3
votes
0answers
135 views

Using the same Fragment class twice in different containers

My question is pretty simple.... i have one container that i assign it with an instance of a fragment class. fragmentTransaction.add(R.id.container2, new PlaceholderFragment2()); my question is can ...
3
votes
0answers
117 views

Remove a fragment of a specific index from a view pager

Im trying to remove a fragment from a specific index. But that is really happening is the viewpager and pagerAdapter are just hiding the last fragment. This is the code: public class ...
3
votes
0answers
98 views

Save & restore Fragment's UI state when pushed and poped out of the backstack

Background: I have a main Activity, it wraps a main Fragment that can be changed, and in order to keep a backstack I use FragmentManager's backstack. The main difference from keeping an activity ...
3
votes
0answers
126 views

Fragment replacing animation issue

I use fragments in my application and I try to implement cool animation of fragment replacing. I use this method for implementing transaction animation. private void ...
3
votes
0answers
107 views

Handling actionbar items from asynctask inside a fragment of ViewPager and Orientation Change

Scenario: I have a MainActivity hosting a ViewPager and PagerSlidingTabStrip which holds 2 fragments. Both fragment uses same class to extend Fragment. Each fragment has a ListView and AsyncTask. ...
3
votes
0answers
150 views

Illegalargumentexception with fragment transaction commit

I am developing an App with TabHost, which contains 4 different Tabviews. Each tabview contains different fragment views added with following code FragmentManager manager = ...
3
votes
0answers
99 views

brightness of google map V2 is very low

I am displaying a bigger version of google map once user click on the small fragment which display map. I am displaying bigger version of map starting map activity in dialog mode. every thing is ...
3
votes
0answers
305 views

FragmentStatePagerAdapter Error

I am new in android application development and when I an trying to use FragmentStatePagerAdapter. I get an error Like ...
3
votes
0answers
69 views

Fragment slide animation is replacing first fragment before animating

I've followed instructions from dmanargias answer here: Android Fragments and animation The animations themselves work, however the initial animation when adding a fragment is doing something ...
3
votes
0answers
144 views

Showing a fragment in response to user input causes IllegalStateException

There are plenty of questions regarding the "IllegalStateException: Can not perform this action after onSaveInstanceState", however I couldn't find anything dealing with a situation when this ...
3
votes
0answers
189 views

Why am I getting this error “android.view.InflateException: Binary XML file line #29: Error inflating class fragment”

I am using Google Map v2 in Tabs. Here is layout file of activity. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" ...
3
votes
0answers
321 views

Change z-order of Fragments during ongoing FragmentTransaction

Is there a way how to change the z-order in which are fragments displayed during an ongoing FragmentTransaction? I've an animation where both fragments overlaps each other and I would like to have the ...
3
votes
0answers
65 views

How to selectively scale a Fragment when Keyboard is activated in Android?

Situation ------------------------------------- | Fragment1 | Fragment2 | | | | | (EditText) | | ...
3
votes
0answers
1k views

BroadcastReceiver with Fragments

I have 3 fragments inside a viewPager currently. One of the fragments is to register a BroadcastReceiver but with the current implementation I am getting nothing at all. @Override public void ...
3
votes
0answers
257 views

How to test nested Fragments?

I have an app that works fine. However I decided to start implementing tests for it. But now I run into some problems: My App uses nested Fragments to use different stacks. I want to test a specific ...
3
votes
0answers
845 views

Fragment isVisible() true when not

I have an Activity with a fragment container and two fragments used like "list fragment -> detail fragment" private boolean isFirstFragmentAdded() { return ...
3
votes
0answers
597 views

Facebook onComplete callback not being triggered in Fragment

I am making a request to the Facebook API using the Facebook SDK. I am trying to retrieve a graph user however it doesnt matter what I do. The callback is not being triggered. How do I trigger the ...