Top "Android-fragments" questions

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

Retrieve a Fragment from a ViewPager

I'm using a ViewPager together with a FragmentStatePagerAdapter to host three different fragments: [Fragment1] [Fragment2] [Fragment3] When I want to …

android android-fragments android-viewpager
android fragment- How to save states of views in a fragment when another fragment is pushed on top of it

In android, a fragment (say FragA) gets added to the backstack and another fragment (say FragB) comes to the top. …

android android-fragments
How can I maintain fragment state when added to the back stack?

I've written up a dummy activity that switches between two fragments. When you go from FragmentA to FragmentB, FragmentA gets …

android android-fragments back-stack
Fragment transaction animation: slide in and slide out

I've check some tutorials for animate transaction between fragments. I've used this method for animation and it works: fragmentTransaction.setCustomAnimations(…

android animation android-fragments
Intent from Fragment to Activity

I was trying to go to another page using button, but it always fail. Here is my First Class with …

android xml android-fragments fragment
Android replace the current fragment with another fragment

I just started with fragment design for HoneyComb. I created two fragments. When i click a button in the left …

android android-3.0-honeycomb android-fragments
Callback to a Fragment from a DialogFragment

Question: How does one create a callback from a DialogFragment to another Fragment. In my case, the Activity involved should …

android android-fragments callback android-dialogfragment
Android DialogFragment vs Dialog

Google recommends that we use DialogFragment instead of a simple Dialog by using Fragments API, but it is absurd to …

android android-fragments android-dialog android-dialogfragment
Android. Fragment getActivity() sometimes returns null

In developer console error reports sometimes I see reports with NPE issue. I do not understand what is wrong with …

android android-fragments android-activity android-asynctask nullpointerexception
Difference and uses of onCreate(), onCreateView() and onActivityCreated() in fragments

What are the differences between onCreate(), onCreateView(), and onActivityCreated() in fragments and what would they each be used for?

android android-fragments android-lifecycle oncreate fragment-lifecycle