Tag: android-fragments

Android memory management granularity – Activity or Process?

I am seeing inconsistent documentation and discussion regarding what happens when Android is low on memory and the steps the OS takes to re-claim memory. More specifically, does Android kill at the granularity of activity/fragment, or entire process? For example, if Activity B is launched in front of Activity A (and both activities are part […]

Cannot save and restore a nested Fragment?

I have a nested Fragment that I am trying to restore the state given an orientation change. So firstly my setup is as follows: Activity -> ParentFragment (SetRetainInstance(true)) -> ChildFragment In My Child fragment I have the onSaveInstance code as follows: @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Serialize the current dropdown position. outState.putInt(STATE_SELECTED_NAVIGATION_ITEM, […]

The Intent constructors parameters

The Intent class had 6 constructors Intent() Create an empty intent. Intent(Intent o) Copy constructor. Intent(String action) Create an intent with a given action. Intent(String action, Uri uri) Create an intent with a given action and for a given data url. Intent(Context packageContext, Class cls) Create an intent for a specific component. Intent(String action, Uri […]

Is onDestroy() guaranteed to be called for Fragments?

I know for an Activity onDestroy(…) is not guaranteed to be called. According to the docs, There are situations where the system will simply kill the activity’s hosting process without >calling this method (or any others) in it, so it should not be used to do things that are >intended to remain around after the […]

Creating and Using a Fragment's View Whilst Not Visible To The User

The Reason I need to do this because I want to get the drawable cache of the fragment’s view and then create a Bitmap from that view. This Bitmap will then be used to publish on Facebook. The Problem When I create my Fragment’s the views are not being created because they haven’t been added […]

How to place the Floating Action Button exclusively on one fragment only in Tab layout

I am trying to achieve the following with no success.I have two material design swipe tabs.I used this library ‘com.oguzdev:CircularFloatingActionMenu:1.0.2’ to achieve FAB but when i swipe the tab to the second tab,the FAB is still attached to the new fragment. I would like to hide the FAB on the second Fragment. Is there a […]

Check existence of a fragment using Robotium – Android

Is anyone aware of a way to check the existence of fragment using Robotium? Regards Rc

RecyclerView not scrolling to the bottom

I followed the recyclerview guidelines and built one for the app I am making, but it does not scroll to the bottom for some reason. I compared it with google code snippets, as well as other code snippets online and can’t see the difference. I have posted a picture and the code I am using. […]

Dynamically adding fragments with xml layout to GridLayout is not workng

In our app we are trying to dynamically add fragments to a GridLayout. The empty grid layout is defined in XML as is the layout for the fragment. At run time we examine some data and from that determine the number of fragments to add to the layout as well as which layout to use […]

Communication between SlidingTabLayout tabs

I’ve searched a lot on how to communicate between fragments using SlidingTabLayout but haven’t really got a good answer. I know using ActionBar but I wanted the new way that is for android lollipop using SlidingTabLayout. I tried this-> http://android-er.blogspot.in/2012/06/communication-between-fragments-in.html but I wanted material design. I referred this link http://www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html for making material design sliding […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.