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

Fragment Webpage is not currently in the FragmentManager

i have an application contains a ViewPager that loads 3 Webpages from local HTML file, it works fine but when i try to start an intent in different activity it crashes with the following message: 05-15 11:33:12.533 …
4mahmoud
  • 813
  • 2
  • 19
  • 31
2
votes
0 answers

android - Adding an Action search bar in Fragment

I’m trying to add a SearchView in the ActionBar of a Fragment which is a part of DrawerLayout. I need the SearchView only for one fragment. I do the following in the onCreateOptionsMenu() method of the Fragment. @Override public void…
2
votes
0 answers

Android Swipe Views Ethernet AndroidPlot & Overall Architecture

I'm quite new to Android development. I'm trying to write an app that communicates by Wifi using UDP to an instrument. The app plots 512 bytes of data it receives over WiFi using AndroidPlot. Transfer rate is satisfactory and communications is…
2
votes
1 answer

Why does Activity's method onCreateOptionMenu() get called two times by using setHasOptionMenu(true) for it's Fragments?

I manage some Fragment's in my own ActionBarActivity named MainActivity. One Fragment is shown at one time. The example should be simple. The Fragment which is showing should have got an option menu under certain conditions. Here my code: public…
2
votes
1 answer

FloatingActionButton! Why it does not work?

public class Advertisment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v =…
2
votes
2 answers

How to send data from BroadcastReceiver to Fragment in android

I am trying to make an chatting app.I have a SlidingDrawer Activity and it has many fragments and among which ChatFragment is one.Now when i am sending message to my friend , i have a Chatting Window and if any message comes from GCM service and i…
2
votes
1 answer

SaerchView in ActionBar showing icon twice and not getting auto focus. Why is that?

I've a SearchView for a fragment in ActionBar. The problem is when I first touch the icon it shifts to the left (Expanded SearchView). Then I have to touch it again to get the text field. The below pics will clarify more. What I have already…
priyank
  • 2,651
  • 4
  • 24
  • 36
2
votes
2 answers

Get Current Visible Fragment From Activity

In my (now deprecated) ActionBarActivity, I want to find out what Fragment is visible so I can call a method inside the correct one. I am doing it like this but it says I cannot cast Fragment with any of the 3 Custom Fragments I created: if…
TheLettuceMaster
  • 15,594
  • 48
  • 153
  • 259
2
votes
0 answers

Android menu of toolbar response to different fragment

Now my mainActivity.xml file like this:
Tim Yu
  • 1,243
  • 2
  • 9
  • 10
2
votes
1 answer

DialogFragment disappears after calling startActivityForResult

I call startActivity from a DialogFragment. However, when I get the result from calling getActivity().startactivityforResult(), my dialog is no longer visible. I can't seem to call startActivityForResult() since onActivityResult doesn't seem to get…
android_student
  • 1,246
  • 1
  • 13
  • 32
2
votes
1 answer

Android Back button not the same action from Fragment and his activity

I've got this : MainActivity.java : package activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import…
2
votes
1 answer

Support Fragment custom animations ignoring interpolator

The interpolator is completely getting ignored in my framgne animations. Is this a known bug or am I missing something? transaction: getSupportFragmentManager().beginTransaction() .setCustomAnimations(R.anim.slide_in_from_top,…
Jonathan S.
  • 1,540
  • 1
  • 15
  • 26
2
votes
3 answers

It's possible to add ImageView programatically on ListFragment?

In my project, I have a Fragment that is a ListFragment. What I have done so far is filling the List with data from a SQLite database; but now, I am facing this problem: If I've no data in the database, my ListFragment will be empty; that's why I…
Skizo-ozᴉʞS ツ
  • 19,464
  • 18
  • 81
  • 148
2
votes
1 answer

Should I use only Fragments or combination of Activity and Fragment?

Trying to make an Android application using Fragments, I've problems choosing the "right" structure in this part: This is supposed to be a certain part of the application where the user should create a new entity (of type A). The entity consists of…
2
votes
3 answers

Fragments not visible on orientation change

In the following code, the fragments are being dynamically inflated from a layout xml. The issue i am facing is that I dont see the fragments when i rotate the device. If I look at the fragmentManager, I do see fragments are there. They are added…
user210504
  • 1,749
  • 2
  • 17
  • 36