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
0 answers

How can change width for each tab in FragmentTabHost

i am using this code for create tab in android. but i can't change width of each tab. i need help you. because i am new in android. i want width of each tab, set to WRAP_CONTENT , but this code don't work! please help me. please post me a clearly…
sheyda
  • 21
  • 3
2
votes
1 answer

Managing data in fragment during home button press

I've been struggling with something recently and I can't move forward until it is properly handled. Here is my problem: Description I've been using a bluetooth inside my activity for a while now. I use it to communicate some data to a remote device.…
2
votes
3 answers

Find a view of a Fragment in the Fragment Activity

I have a FragmentActivity in which a Fragment is attached. Now at a particular step in onBackPressed of the Fragment Activity, I want to change the DRAWABLE OF A BUTTON which is defined in Fragment and not in the Fragment Activity. My Question is:…
Gaurav Arora
  • 8,282
  • 21
  • 88
  • 143
2
votes
2 answers

How to refresh previous fragment after closing an activity?

I have a fragment that throws an activity in which user can insert some details. When the user terminate to fill data the activity close. Then the previous fragment is showed and I want it to be updated (with the data provided by user in the…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
2
votes
4 answers

Failed to get arguments in a Fragment

I have an inconvenience and hope me can help. I have a class that extends Fragment in which you have created an instance to receive parameters public class FragmentPlaySong extends Fragment { .... private ArrayList songList; private int…
2
votes
1 answer

Fragment partially covered by another fragment

I am opening another fragment (DialogFragment) on top of an existing fragment. The previous fragment is still partially visible. I don't get onPause event on it. Is there any other event we can use when a fragment is pushed into background but…
Stephen Cheng
  • 964
  • 2
  • 11
  • 24
2
votes
0 answers

Home Button Navigation not working properly

I am using action bar and fragments in my android app. I have home button in base activity and other fragments . These home buttons have different functionality. while clicking fragment home button it forces a click in home button in the activity…
Divya
  • 555
  • 1
  • 4
  • 15
2
votes
1 answer

"error: cannot find symbol method" in Android Studio

I'm learning how to program Android in Android Studio slowly but surely, working on an app to open the mobile Facebook site in a fragment, with the intent to make multiple fragments for multiple social networks. I have my main (Facebook) fragment,…
2
votes
1 answer

FullScreen Dialog above action bar

I have a FragmentActivity and a few fragments in my application. In some conditions , i'll pop a dialog from activity, it will be fullscreen but it should stay below main action bar. is it possible ? ( I want to keep main action bar visible ) My…
dracula
  • 4,413
  • 6
  • 26
  • 31
2
votes
1 answer

How do you set a Menu item listener (onMenuItemSelected) in a FragmentPagerAdapter?

I'm trying to have a Fragment inside a FragmentPagerAdapter have its own onclicklistener for a MenuItem. In other words, I'm trying to use an Activity's onOptionsItemSelected method inside a Fragment How do I do this? I've tried using…
2
votes
2 answers

Difference between StartActivity and FragmentTransaction

What is the difference between Intent i = new Intent(getActivity(), HomeworkPagerActivity.class); i.putExtra(HomeworkFragment.EXTRA_HOMEWORK_ID, c.getId()); startActivity(i); and: HomeworkFragment newFragment = new HomeworkFragment(); Bundle args…
waylonion
  • 6,866
  • 8
  • 51
  • 92
2
votes
1 answer

Pass data between two fragments in same activity and update WebView

Hello I'm trying to pass a String value from a fragment to another one. I have a single Activity. The thing that I'm trying to do is when a listview item is pressed send the value to the another fragment, load the fragment (This I had made with this…
makgyverzx
  • 39
  • 6
2
votes
2 answers

How to convert activities to fragments to use in drawer

I am planning to convert the activities in my app to fragments to implement a drawer. But I have never used fragments before and they seem kinda complicated, so I'm asking for some quick help: What are the basic "rules" to convert from activity to…
KKO
  • 1,913
  • 3
  • 27
  • 35
2
votes
1 answer

How to get Data from current fragment to other fragment?

I am using Fragment for my current application. Here I have one Fragment FA and I am navigating to the other Fragment FB and I have added FA to the backstack as I want to come to FA fragment on some event to be done in FB fragment. I have a done…
Salman Khan
  • 2,822
  • 5
  • 32
  • 53
2
votes
1 answer

Nested fragments: java.lang.IllegalArgumentException: No view found for id

I have a fragment A, containing a listview. To this listview I add a listheader containing a ViewPager that pages through childfragments. When the user clicks an item in the list, the listfragment A gets replaced by a detail-view-fragment of that…
A. Steenbergen
  • 3,360
  • 4
  • 34
  • 51