Questions tagged [android-fragmentactivity]

An Activity subclass introduced through the compatibility package to provide an implementation of the Fragment framework on version below Honeycomb.

An Activity subclass introduced through the compatibility package to provide an implementation of the Fragment framework on version below Honeycomb. This class doesn't work with Fragments from the SDK, it needs the Fragment related classes from the compatibility package.

More information can be found in the documentation of the FragmentActivity.

2111 questions
7
votes
1 answer

Fragment activity gets destroyed when entering new activity from fragment and going back

I have an activity of type FragmentActivity. Inside I have some content using view pager, where each scrollable tab is a fragment:
andy57
  • 123
  • 4
7
votes
2 answers

The hierarchy of the type MainActivity is inconsistent

I created a new Android project via eclipse, with a MainActivity. I added ActionBarSherlock to the project (Properties > Android and clicked Add). Then, when I replace "extends Activity" with "extends SherlockFragmentActivity" I get a compile error…
user2329454
  • 153
  • 2
  • 3
  • 7
7
votes
4 answers

Access a method of a Fragment from the ViewPager Activity

I have a Fragment with a method setName() that changes an EditText text, by means of the setText function. What is the best way to call that method from the activity that hosts that fragment by means of a ViewPager? In other words, how can I access…
7
votes
3 answers

Are Fragments and Fragment Activities inherently faster than Activities?

Are Fragments and Fragment Activities inherently faster than Activities? If I don't need to load my activity in fragments, should I be using FragmentActivities and Fragments over Activities? Reason I am asking is because I have been using…
7
votes
2 answers

Fragments Detatch/Reattach Vs Show/Hide

I am having trouble figuring out the proper way to navigate through fragments without a pager and i am having problems during Configuration changes for screen orientation. I am using Show/Hide on the fragments to make them visible and functional but…
doubleA
  • 2,446
  • 22
  • 45
7
votes
1 answer

Prevent next fragment (tab) from preload with ViewPager

I am developing an app in Android using Fragments. I have this three tabs: I know that is not possible to prevent the load of one fragment on each side (previous and next) as far as the minimum value of setOffScreenPageLimit() is 1 but does it mean…
Keyser Sozé
  • 739
  • 1
  • 9
  • 16
7
votes
4 answers

How can I put titles in ViewPager using fragments?

I am using ViewPager to allow user to swipe between fragments. How can I add a the title of each fragment to the screen? package com.multi.andres; import java.util.List; import java.util.Vector; import…
6
votes
2 answers

Show confirmation dialog in Fragment

I'm converting my Android application to use fragments. Previously, I had an activity that is now a fragment. Hence, this code can no longer be used: showDialog(CONFIRM_ID); // ... @Override public Dialog onCreateDialog(int id) { // Create the…
l33t
  • 18,692
  • 16
  • 103
  • 180
6
votes
0 answers

How to share data between Activities with LiveData?

I have two Activity and one Fragment. I want to share data between these Activities. In fact, when the user changed FragemtA in MainActivity, must be update FragmentA in SecondActivity automatically. My ViewModel: PlayerFragmentVM.java public class…
6
votes
2 answers

Access Activity Variables in Fragment

If i have an Activity A which extends a base activity BA then i am able to safely access any variable in activity BA from activity A.What i am using now contains an activity A which includes a fragment F. Now from this fragment i want to access all…
6
votes
2 answers

Fragment Backstack is not restored when orientation changes

I have a FragmentActivity, when the user navigates through the app, I replace the current fragment with the fragment the user has selected and add add the transactions to backstack. Everything works fine, the user can go back to the previous…
6
votes
3 answers

Why using Fragments?

I have read the documentation and some other questions' threads about this topic and I don't really feel convinced; I don't see clearly the limits of use of this technique. Fragments are now seen as a Best Practice; every Activity should be…
6
votes
4 answers

Hide Action Bar in a Fragment Activity

I am creating the framework for an app and wish to hide the action bar for the login activity. The app is going to be entirely composed of fragments because they are awesome. I can hide the action bar fine for my activity, but every time I run the…
6
votes
2 answers

can't use method "getString(int resId)" in FragmentPagerAdapter

I've the following class in my fragment activity now i want to get name of tabs from strings.xml but i can't able to use method getString(int resId) it gives a error message "Cannot make a static reference to the non-static method getString(int)…
Nitin Misra
  • 4,472
  • 3
  • 34
  • 52
6
votes
3 answers

App crashing when using fragments

Im working with fragments and.. Ive got a problem in my code that I just cant find. The logcat points at this piece of code, in one of my fragments: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle…