Top "Android-fragments" questions

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

How to determine when Fragment becomes visible in ViewPager

Problem: Fragment onResume() in ViewPager is fired before the fragment becomes actually visible. For example, I have 2 fragments with ViewPager …

android android-fragments android-viewpager
Get the current fragment object

In my main.xml I have <FrameLayout android:id="@+id/frameTitle" android:padding="5dp" android:layout_height="wrap_content" …

android android-fragments
How to correctly save instance state of Fragments in back stack?

I have found many instances of a similar question on SO but no answer unfortunately meets my requirements. I have …

android android-fragments
Replacing a fragment with another fragment inside activity group

I have a fragment inside a group activity and I want to replace it with another fragment: FragmentTransaction ft = getActivity().…

java android android-fragments
Error inflating class fragment

I get the Error Unable to start activity ComponentInfo{de.androidbuch.activiti/de.androidbuch.activiti.task.Activity}: android.view.InflateException: …

android android-layout android-fragments
How to add Options Menu to Fragment in Android

I am trying to add an item to the options menu from a group of fragments. I have created a …

android android-fragments android-optionsmenu
Refresh Fragment at reload

In an android application I'm loading data from a Db into a TableView inside a Fragment. But when I reload …

android android-fragments
Update ViewPager dynamically?

I can't update the content in ViewPager. What is the correct usage of methods instantiateItem() and getItem() in FragmentPagerAdapter class? …

android android-fragments android-viewpager
Call an activity method from a fragment

Trying to call a method in my activity from a fragment. I want the fragment to give the method data …

android android-fragments
Programmatically go back to the previous fragment in the backstack

Say I have an activity that has fragments added programmatically: private void animateToFragment(Fragment newFragment, String tag) { FragmentTransaction ft = getFragmentManager().…

android android-fragments back-stack