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
248
votes
2 answers

Difference between Activity and FragmentActivity

I was working on fragments and came across two things Activity and FragmentActivity which are used several times. I want to know that is there any difference between these two, because when I changed Activity with FragmentActivity, it had no effect…
211
votes
10 answers

Android ViewPager with bottom dots

I want to add 3 bottom dots to my ViewPager, like this. I use FragmentActivity and support library ViewPager.
211
votes
22 answers

How can I access getSupportFragmentManager() in a fragment?

I have a FragmentActivity and I want to use a map fragment within it. I'm having a problem getting the support fragment manager to access it. if (googleMap == null) { googleMap = ((SupportMapFragment) getSupportFragmentManager() …
182
votes
10 answers

startActivityForResult() from a Fragment and finishing child Activity, doesn't call onActivityResult() in Fragment

FirstActivity.Java has a FragmentA.Java which calls startActivityForResult(). SecondActivity.Java call finish() but onActivityResult never get called which is written in FragmentA.Java. FragmentA.Java code: @Override public void…
mrsus
  • 5,446
  • 4
  • 31
  • 44
164
votes
4 answers

What is the difference between Fragment and FragmentActivity?

My question is apart from the obvious inheritance differences, what are the main differences between Fragment and FragmentActivity? To what scenarios are each class best suited? I'm trying to get an understanding of why both of these classes…
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97
129
votes
7 answers

FragmentPagerAdapter getItem is not called

I am not able to reuse fragment in FragmentPagerAdapter.. Using destroyItem() method, It is deleting the fragment but still does not called getItem() again..There are just 2-3 Images so I am using FragmentPagerAdapter Instead of…
Kanika
  • 10,648
  • 18
  • 61
  • 81
107
votes
7 answers

Start an activity from a fragment

I have 2 fragments with on both fragments a button. When I press the button I'd like to start a new Activity. But I can't get it to work. The error I'm getting: ERROR here: Type mismatch: cannot convert from mFragmentFavorite to Fragment What am I…
mXX
  • 3,595
  • 12
  • 44
  • 61
102
votes
22 answers

Setting Custom ActionBar Title from Fragment

In my Main FragmentActivity, I setup my custom ActionBar title like this: LayoutInflater inflator = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflator.inflate(R.layout.custom_titlebar,…
92
votes
29 answers

Default Activity not found in Android Studio

I just upgraded to Android Studio 0.2.8 and I am getting an error that says "Default Activity not found" when I try to edit the run configurations. When I launch Android Studio I get this error "Access is allowed from event dispatch thread only" The…
88
votes
11 answers

Android check null or empty string in Android

In my trying AsyncTask I get email address from my server. In onPostExecute() I have to check is email address empty or null. I used following code to check it: if (userEmail != null && !userEmail.isEmpty()) { Toast.makeText(getActivity(),…
user3384985
  • 2,975
  • 6
  • 26
  • 42
85
votes
3 answers

Android - Activity vs FragmentActivity?

I am new in Android. I want to build an app with tab format. I found many documentation where Activity has been used. Also in many cases have used FragmentActivity. I am not sure which will be better to start. Please suggest me should I use Activity…
zaz
  • 970
  • 1
  • 7
  • 8
77
votes
5 answers

How to properly retain a DialogFragment through rotation?

I have a FragmentActivity that hosts a DialogFragment. The DialogFragment perform network requests and handles Facebook authentication, so I need to retain it during rotation. I've read all the other questions relating to this issue, but none of…
76
votes
5 answers

"Failure Delivering Result " - onActivityForResult

I have a LoginActivity (User Logs in). It is basically its own Activity that is themed like a dialog (to appear as if a dialog). It appears over a SherlockFragmentActivity. What I want is: If there is a successful login, there should be two…
65
votes
13 answers

Hide/Show Action Bar Option Menu Item for different fragments

I have a Sherlock Fragment Activity in which there are 3 Fragments. Fragment A, Fragment B, Fragment C are three fragments. I want to show a done option menu in Fragment B only. And the activity is started with Fragment A. When Fragment B is…
Gaurav Arora
  • 8,282
  • 21
  • 88
  • 143
63
votes
6 answers

How to get application object into fragment class

I am changing my android mobile app to support both tablets and mobile phone. For this I am changing my activity class into fragment. In my activity class I have an instance of my application class created as below: appCtx = (UnityMobileApp)…
Rakesh Gourineni
  • 1,361
  • 5
  • 16
  • 30
1
2 3
99 100