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

Checking URL fragment for a keyword

i use the following to take a URL e.g. domain.com/#2 and then i use that fragment to redirect the users to domain.com/?page=2. However, sometimes the user may be shown just a single hash and no number or i might use a keyword in the URL when…
Lovelock
  • 7,689
  • 19
  • 86
  • 186
2
votes
2 answers

Using GridView inside Fragment with ArrayAdapter

I am creating a fragment where I want to display a simple gridview that will be generated from a StringArray. I don't need anything complicated, the basic ArrayAdapter works just fine for creating the gridview when not in a fragment. However, when I…
JMGoodwin
  • 80
  • 1
  • 6
2
votes
1 answer

Saving the state of a listview in a fragment in my activity

I'm new to android and I know similar questions like this have been asked before, I've looked at their answers and none of them seem to solve my problem I have a listview in a fragment in my activity that retrieves information from a URL and…
samieaji
  • 46
  • 5
2
votes
2 answers

FragmentPagerAdapter.getItem (int) shows wrong Fragment

My FragmentPagerAdapter carries the 3 pages of ViewPager.OffScreenPageLimit and always displays the last loaded page I use ViewPager to display Fragments. my ViewPager private static final int MONTH_SIZE = 12; …
2
votes
0 answers

Intercept gestures on fragment that contains scrollable widget (scrollview, listview etc)

I am having trouble with a portion of an application I am working on regarding gesture recognition which has been driving me nuts for a good few hours now... I have an activity containing two FrameLayouts which fill the entire screen, one contains…
rcbevans
  • 7,101
  • 4
  • 30
  • 46
2
votes
2 answers

getArgument is NULL, why?

I am trying to pass values through a Bundleusing setArguments() from an activity to another class extends Fragment when I press one of the listed items in a ListView. As shown below, I used a Log.i statement to know if the Bundle received is null…
user3558352
2
votes
2 answers

Change the color of Contextual Action Bar

I'm trying to figure out how to change the color of the contextual action bar menu (CAB) for example i want to have red CAB in my app,and i use the CAB in one of my fragments, Any help would be appreciated! Thanks!
Ladan Nekuii
  • 185
  • 1
  • 6
  • 18
2
votes
1 answer

Swipe ListView 47deg inside a fragment of ViewPager

Im trying to implement Swipe ListView open source library by 47Deg inside a fragment of ViewPager. I tried this library in simple Activity and it work flawless. References to this library are follow: Library GitHub Tutorial YouTube…
Bilal Rabbani
  • 1,288
  • 14
  • 24
2
votes
1 answer

Transaction from fragment to activity(java class)

FragmentOne public class FragmentOne extends Fragment { public FragmentOne() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { …
Alex
  • 49
  • 9
2
votes
1 answer

My Fragment is not being attached to the Main Activity Class.

Taking my previous experiences, i am trying to list some custom list items using BaseAdapter , which uses two string from array defined in string values.xml My app is crashing saying that my fragment is not attached with activity. MainActivity.java…
BST Kaal
  • 2,993
  • 6
  • 34
  • 52
2
votes
3 answers

Going back to the previous Fragment

I have a program where when one user clicks on a button, it takes them from one fragment to another. The issues is that I want the previous fragment to reappear once the click the back button. Code below: This is creating the first…
2
votes
1 answer

Viewpager, fragment lifecycle on activity recreation

I have a FragmentActivity with a ViewPager instance that uses a FragmentPagerAdapter. I create a list of fragments instances first, and then pass it to the adapter so it can return the right fragment for the right page. My question now is how to…
2
votes
5 answers

Can't run ShowcaseView from Fragment in android

I use the last version of ShowcaseView from here When I tried to use it with demo app and activity it works but when I tried to use it with fragments it crashed my app with no logcat errors @override public void onActivityCreated(Bundle…
Alex K
  • 5,092
  • 15
  • 50
  • 77
2
votes
1 answer

Fragment-specific options and context menus in Android

How do I realize options and context menus in a "clean" and proper way, when an Activity switches between several fragments? Here example code using a NavigationDrawer: public class MainActivity extends Activity implements…
user2368140
2
votes
0 answers

Fragment popbackstack is calling the previous fragment oncreateview instead on onstart. How to make it call onStart?

Am Replacing Fragment B on top of Fragment A. Then Some time Later am calling popBackStack();. It's Pop the current fragment B from stack. Then Fragment A's OncreateView is getting called. I am not sure When the Fragment A get's detached from an…
M Vignesh
  • 1,586
  • 2
  • 18
  • 55
1 2 3
99
100