Questions tagged [fragment]

**DO NOT USE**: fragment is an ambiguous tag, used to refer to numerous technologies. Prefer less ambiguous tags. For Android Fragments, use [android-fragments]. For URL fragments, use [url-fragment]

'fragment' Tag Disambiguation

8161 questions
2
votes
1 answer

Android set menu items dynamically at startup

I need to change the title of a menu item in my action bar at startup based on a few variables which get created at the startup. But for some reason I cant simply do that since the menu items take time to inflate maybe? how do I get around this…
Ams
  • 347
  • 1
  • 3
  • 12
2
votes
2 answers

Retrieve mysql data as a listView in an android fragment

I'm an android beginner, and I'm trying to find a way to retrieve data from a mysql database into a ListView, but in a Fragment instead of in an Activity. Is that even possible? Can someone give me some advises??
gaiaayan
  • 23
  • 2
  • 6
2
votes
2 answers

saved instance bundle is null in onCreateView for DialogFragment

I am saving a key value pair before displaying the warning dialog. However the onCreateDialog() for the dialog is called with a null bundle. Is there something extra I need to do to pass the bundle to the dialog? MyDialogFragment testFrag= new…
user2399453
  • 2,930
  • 5
  • 33
  • 60
2
votes
2 answers

Sliding menu Android

I have an app that is using tabHost menu and I need to change it, because the menu items is growing and they don't fit in the current menu. My classes are extending FragmentActivity, I want to know if is possible to use Sliding Menu with them or I…
jackcar
  • 659
  • 3
  • 13
  • 28
2
votes
1 answer

getArgument() returns NULL

In the below code I am tryin to pass sensor values from Frag1 to Frag2 through the mainActivity. Frag1 implements sensorEvenListener and in Frag1's onResume i pass the values to the mainActivtiy by sendValues.onSendValues(getAccX(), getAccY(),…
rmaik
  • 1,076
  • 3
  • 15
  • 48
2
votes
1 answer

android fragment popBackStack without POP_BACK_STACK_INCLUSIVE

I have a deep, nested, fragment application. When I use the below code all works. fragmentManager.popBackStack("root", FragmentManager.POP_BACK_STACK_INCLUSIVE); However I want to keep the root fragment so I…
Blodhgard
  • 9,130
  • 3
  • 24
  • 36
2
votes
3 answers

Fragment.setAllowEnterTransitionOverlap(false); doesn't work (enter and exit animation overlap)

I'm replacing Fragment with : Fragment fragment = new TheFragment(); fragment.setAllowEnterTransitionOverlap(false); getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.fade_in, R.anim.fade_out).replace(R.id.LayoutContent,…
2
votes
2 answers

Dynamically enable/disable menu items in Android

I am developing an app, where I am using Swipable Tabs - implemented using FragmentActivity and respective Fragment for each Tab. Now I have checkboxes in each Fragment (Tab). I need to enable few Menu items in the Action Bar (like Send/ Share/…
Ramky
  • 23
  • 1
  • 1
  • 4
2
votes
1 answer

Imageresource can't make it work: Incompatible types

I'm working in a fragment but I can't make the imageresource to work. package hej.swipeview; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import…
elin.a
  • 33
  • 1
  • 5
2
votes
1 answer

Getting mixed data when using EventBus in a ViewPager

I am using EventBus to post the result to a fragment when an http request is made successfully. This works nice when there's a one subscriber and one publisher relation. However, in my application I have a screen that uses a ViewPager with tabs.…
VCODE
  • 535
  • 5
  • 19
2
votes
1 answer

Android FragmentTransaction won't add or replace fragment to container

This question has been asked before, however, I have not found an appropriate answer for my problem. I am building a simple fragment activity that displays three buttons at the top of the screen in one container that when pressed update the…
Jonnie Blout
  • 21
  • 1
  • 3
2
votes
5 answers

Fragment hide not working in Android

My requirement is, I've a main activity and I want to display an image and text instead of progress bar in a separate fragment. I've a separate fragment and I want to display the fragment when user clicks on a button in MainActivity. My issue…
2
votes
1 answer

What are the guidelines governing back button behavior when using a navigation drawer?

What is the recommended way to handle back button presses in an app that contains many Fragments accessible via a navigation drawer? I see two possibilities: add all Fragments to the back stack, so that when the user presses the back button he(she)…
despecher
  • 806
  • 6
  • 15
2
votes
0 answers

Java null pointer aftertextchanged in fragment

I have navigation drawer menu with several fragments, one of my fragment have EditText in action bar for listview search function, it's work great but when the user clicks the same fragment for the second time or click it from another fragment the…
mrconga
  • 31
  • 7
2
votes
0 answers

Fragment Lollipop Transitions

I have set up fragment transitions on entering and exiting the fragment. And when ever I press back android throws this error: NullPointerException: Attempt to invoke virtual method getAllowReturnTransitionOverlap() on a null object reference.…
George
  • 235
  • 3
  • 9