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
23
votes
1 answer

Fragment as a singleton in Android

General Question Can I define Fragments as Singletons? Specific question In my application I have one 'FragmentActivity' with a FragmentPager which has two Fragments, FragmentA and FragmentB. I defined the fragments as Singletons in the FragmentA…
22
votes
3 answers

issue in Android Fragment : still click on previous fragment

I have developed an application that have navigation Drawer and many fragment inside drawer so I getting issue while I am open fragment inside fragment, in one fragment I have List view when user click on listview item they getting data related to…
user2776223
21
votes
3 answers

FragmentActivity onSaveInstanceState not getting called

I have seen a few similar questions about onSaveInstanceState not getting called for Fragments, but in my case Fragments work fine, it's the main FragmentActivity that's having trouble. The relevant code looks fairly simple: public class…
SaltyNuts
  • 5,068
  • 8
  • 48
  • 80
21
votes
5 answers

OnLoadFinished() called twice

I'm trying to figure out if I'm doing something wrong with respect to Loaders. I'm using the support library, and I have a Fragment which in onCreate() calls initLoader() setting itself as the LoaderCallbacks, however on a rotation it is receiving…
20
votes
1 answer

Difference between onResume() and onResumeFragments()

FragmentActivity.onResume() javadoc: Dispatch onResume() to fragments. Note that for better inter-operation with older versions of the platform, at the point of this call the fragments attached to the activity are not resumed. This means that in…
18
votes
3 answers

Calling Activity Method From Inside A Fragment

I am trying to call a method in an activty from a Fragment screen. I have a method called myMethod() which is in an activity called MyActivity; I have a fragment called Screen1Fragment. I would like to call MyActivity.myMethod() from inside the…
18
votes
4 answers

getSupportActionBar using FragmentActivity

I'm using fragment activity on one project, but it seems v4 support FragmentActivity doesn't has getSupportActionBar() method, and I need to use the support one in order to use android.support.v7.app.ActionBar
18
votes
2 answers

Saving MapFragment (Maps v2) State in Android

I'm working with the new GoogleMaps API (v2) and have some problems with the fragment. I have two fragments in my app (Map, List) and the user can switch between them. Works fine so far with this code: if (itemPosition == 0) { …
17
votes
10 answers

PopBackStack but keep the first fragment in android

I am working on fragment transaction, and the backstack is like this: fragA => fragB => fragC => fragD I would like to return to fragA after back fromn the fragD fragD => onBackPress => fragA So, I tried code…
17
votes
1 answer

Android Replace Fragment within a Fragment

I have a Fragment called "MeinProfilFragment". And a MainActivity which handles the ActionBar-Tabs logic. In the "MeinProfilFragment" i have put the logic for a "Login-Process". After the user logged in successfully i want to display…
JuJu
  • 307
  • 1
  • 3
  • 18
16
votes
3 answers

Right Approach to Call Web Service(API) from Fragment class

I need to know, In which fragment callback method, we should call a web service by which after come back to fragment web service should not call again. For example. I have a fragment class MyFragment.java public class MyFragment extends Fragment…
16
votes
2 answers

Android - IllegalStateException: map has zero size

I'm a novice android programmer. Let me give some context. My project uses ActionBarSherlock. I have an activity (Activity1) that contains two fragments - a SherlockListFragment and a SherlockFragment containing a google maps MapView (essentially…
16
votes
4 answers

Global Loader (LoaderManager) for reuse in multiple Activities / Fragments

What I would like to achieve: I have two different fragments. I would like them both to show the same data in two forms (in a list and on a map). I would like them to share one Loader (AsyncTaskLoader in particular). Everything works fine, but the…
14
votes
0 answers

Why am I getting "Unable to pause activity IllegalStateException: Restarter must be created only during owner's initialization stage" in Android?

I am using a FragmentActivity and sometimes on Crashlytics, I am able to see an exception Fatal Exception: java.lang.RuntimeException: Unable to pause activity Below is the onPause of my FragmentActivity @Override protected void onPause() { …
14
votes
4 answers

how to set toolbar on FragmentActivity?

I want to set toolbar on my activity which extends FragmentActivity. I know that for use setSuppoertActionBar(toolbar) method we extends AppCompatActivity instead of FragmentActivity but I override the onMenuItemSelected(int featureId, MenuItem…
Ekta Bhawsar
  • 746
  • 11
  • 26