Most voted "android-fragment" questions
It is one of the great novelties of the Android API, which emerged after the version Android 3.0 Honeycomb, thanks to the arrival of tablets in the market.
Learn more…321 questions
Sort by count of
-
13
votes2
answers4510
viewsWhat is the difference between Activity, Fragmentactivity and Fragment?
What are the differences in functioning, performance etc. in inheriting from each of the classes in controllers views (XML) on Android?
-
9
votes1
answer5967
viewsWhat’s the difference between drawing in Activity and in Fragment?
After the last SDK update in Eclipse, when creating a new project, a fragment next to activity_main. I would like to know why the fragment, since before it opened directly to activity_main. Is there…
-
8
votes1
answer660
viewsCommunication between Fragment and Activity
I’m making an Android app that uses time and date switches (Datepicker and Timepicker), which are displayed in the form of Fragments. When the user sets the desired time, I need it to be passed from…
-
8
votes1
answer374
viewsHow to assign an Activity to open by clicking on the Actionbar Tab?
Context I have an application that contains a Activity calling for MapActivity (of which is a Map activity you inherit from the Googlemaps api), and another Activity which will serve as a search…
android android-fragment actionbar android-adapterasked 9 years, 5 months ago Paulo Roberto Rosa 8,979 -
8
votes3
answers330
viewsDoubt game two players, half screen upside down
I am creating a program to practice what I have learned so far and learn more, but I have reached a halt. The doubt is as follows: I’m creating a question and answer game for two players, each one…
-
6
votes2
answers4150
viewsChanging Screens in Navigation Drawer
The Navigation Drawer had some changes, where the method was used onNavigationItemSelected(int position, long itemId) and now comes with the method onNavigationItemSelected(MenuItem item). I tried…
-
6
votes1
answer277
viewsUpdate Textview on onResume
package br.com.automaserv.stocserv.fragments; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import…
-
5
votes1
answer260
viewsHow to inflate a class on Android?
I needed to inflate a form into a tab, always make the form in xml, but this time I did it via code, someone knows how to display my class instead of xml in a FragmentTab? Code to inflate an xml in…
-
5
votes2
answers7398
viewsstartActivityForResult() and onActivityResult() in Fragments
I have a MainActivity that allows me to open two Fragments. The class Fragment_1 has a Button that in his Listener opens a second activity through the following call: Intent intent = new…
-
5
votes1
answer755
viewsChange icone action back with Fragment
Good morning, everyone, I’m having trouble changing the action of the icon back <- on my Toolbar. I have two Fragments A and B being that B are details of A. - When I’m on Fragment B and I press…
-
4
votes2
answers4107
viewsHow do I pass parameters from the last Fragment to the previous Fragment?
I have the following situation: the Fragment A and from it, with a button click event, goes to the Fragment B. When you’re in the Fragment B and press the back button in order to return to the…
-
4
votes1
answer1755
viewsWhat does popBackStack()?
I can’t understand or find anywhere that makes me understand what the method does getActivity().getSupportFragmentManager().popBackStack(); Not even reading the documentation I could understand,…
-
4
votes1
answer841
viewsDifference between calling the Fragment call and a new instance
I’m working on a college project where I made an app that uses Ragments. I’ve always been used to creating a Fragment as follows: // imports ... public class LoginFragment extends Fragment { public…
-
4
votes1
answer1039
viewsHow to pass the Edittext value of a Fragment to the Textview of another Fragment?
I have a Fragment that contains an Edittext in which the user will enter his name. In another Fragment is Textview which will receive the name typed in the previous Fragment. Fragment Edit (where…
-
4
votes1
answer259
viewsproblem with vectors in android studio
I’m having trouble inserting vectors in android studio my project was created in api21 (5.0), I am testing on a 7.0 device and this is all ok , working perfectly, but an error occurred when running…
-
4
votes1
answer552
viewsHow to use a custom Adapter on android Listfragment
Hello folks I’m having problems with using a Adapter customized and display this Adapter in a Listfragment. My Custom Adapter public class UsuariosAdapter extends BaseAdapter { Context ctx; List…
java android listview android-fragment android-adapterasked 9 years, 4 months ago ThiagoDeveloper 55 -
4
votes1
answer9504
viewsCreating tabs the right way on Android currently
I’m trying to implement in the app I’m creating Tabs, like this: But always when I try to implement I face classes and methods deprecated, as an example, TabListener, ActionBarActivity and now I’m…
-
4
votes2
answers2215
viewsChange Fragment by clicking on a button inside another Fragment
I have a button inside my Ragment that I want it to call another Ragment that is over the current one when it is clicked. follows the code of Fragment: @Override public View…
-
3
votes1
answer585
viewsAndroid Xzing library (read barcode) with Fragment
My application worked perfectly with Zxing, after implementing Fragment, the barcode reading stopped working. I tried to configure the return in Fragment, in Activity... but I was unsuccessful.…
-
3
votes3
answers4673
viewsPass data between Fragments
Here’s what I need: I have an applicationActicitythis is the main and controls the entire application, also I have some fragments2 of them are interface other 2 run in the background. The question…
-
3
votes1
answer608
viewsWhen you have a reference in Fragment through getActivity() should I use an interface?
My doubt is knowing the best way to work for the organization of methods, I will present 2 implementation options that I am in doubt, whenever I have in Fragment a reference through getActivity() I…
-
3
votes1
answer334
viewsHow popular is Alertdialog in Android Studio?
I’m taking a shit here from Java and Android Studio. I have already created an Activity + Dialogfragment, Location information does not pass from the Activity screen to Dialogfragment! Now I’m…
-
3
votes1
answer2358
viewsPlacing event click on the button that is in a Fragment, in an Activity?
I want to put a setOnClickListener on the button that is in a Fragment, through my Activity. Follow the codes: Activity: private Button mButtonCriarConta; // onCreate da Activity...…
-
3
votes1
answer896
viewsHow to change the name in the top bar dynamically when a Fragment is selected?
I want the name in the top bar to change according to the Fragment that is selected, for example, I chose the screen to list customers, so in the bar would appear "List Customers", but I’m not…
-
3
votes1
answer487
viewsFragment is not overriding the marked layout
I’m working on a college project and I’m having a hard time replacing a given layout by a fragment. What is happening is that, the fragment is not replacing the layout of Activity but yes, mixing…
-
2
votes1
answer740
viewsHow to maintain screen orientation?
I would like to know the equivalent code in Java for this command: android:configChanges="orientation" Justification: I’m creating an app with Layout NavigationDrawer, and need that on certain…
-
2
votes1
answer341
viewsI cannot replace the fragments displayed in Viewpager
I am retracing the navigation of an application so that it works as follows: the application consists of a single activity that initially displays a ViewPager with three views (Fragments), and in…
-
2
votes0
answers433
viewsHow to destroy previous Ragment?
In my Android project I navigate between fragments, in one of these fragments, there is a list that receives information from a json. It appeared the need to update this list every 1 minute, I’m…
-
2
votes1
answer107
viewsWhich event shows if the android keyboard is active or not?
There is some event or method that shows if the keyboard is active on the android screen, because I need to do this check in a Fragment.
-
2
votes0
answers86
viewsFragmenttransacion with Fragment Activity
I’m using the Navigationdrawer to display the page options, I adapted one of them to Fragmentactivity for the call of some functions right. But when declaring the transaction of the screens, it does…
-
2
votes1
answer313
viewsFragment:error inflating class Fragment
I’m using Fragment to do the navigation "drawer", ie on topics with options, but I’m found this error, but I’m not sure what it is, follows what it says in logcat: 12-22 20:08:25.774…
-
2
votes1
answer66
viewsTabbed Activity of Error
Hello, I’ll be as objective as possible: I created a project in Android Studio of "Tabbed Activity" - Action Bar Tabs By app options(right mouse) New -> Fragment -> Fragment Blank created a…
-
2
votes3
answers1031
viewsHow to insert markers (Marker) into a map in another Fragment?
I’m developing a app Android where you insert a courier task list (pick something up on the dot A and bring to the point B) and these dots are shown on a map. The App has two fragments:…
-
2
votes1
answer65
viewsError returning in getView method
I’m doing the app in Action Bar and I have a problem returning the value within the method getItem. Here’s the code: Java test. public class Teste extends Fragment { @Override public View…
-
2
votes1
answer258
viewsHide Actionbar in one Ragment but show in another
I am working on a project that is being done virtually all based on fragments. So far, I’ve only got one activity and 4 fragments, within which I need only one of them not to have the ActionBar.…
-
2
votes2
answers308
viewsHow do I access an Arraylist of Fragments after a screen rotation?
I was trying to programmatically add to my Activity a list of Fragments that implement some Cardviews. These Cardviews have some Textviews that I would like to set from my Activity, and in fact, it…
-
2
votes1
answer97
viewsInitialize element from one fragment into another
I have two fragments attached to my Victoria. My doubt is, how I initialize an element that is in another fragment? In a fragment, to access Activity I use the code Textview tv =…
-
2
votes1
answer58
viewsNullpointerexception when trying to use interface to pick up data from one Ragment to another
I’m doing a program that creates graphs, that contains a page with two tab Fragments one for the graph and another for the algorithms I’m trying to make when a button is clicked on the algorithms…
java android android-fragment nullpointerexception interfaceasked 5 years, 8 months ago Gabriel Ricardo 31 -
2
votes2
answers993
viewsHow to get data from a text displayed in the dialog
I am using this library to display dialogs in my application: https://github.com/drakeet/MaterialDialog With this library it is possible to display in the dialog a layout created, but I am not able…
-
2
votes0
answers89
viewsNot doing the replace Fragment
Hello, I have an app that so when it is accessed loads a feed, Initiating an Asynctask, but if the user presses in one of the options of Drawer before the Task ends, the app does not replace and…
-
2
votes3
answers531
viewsUsing Activity Methods in a Fragment
I am trying to use some methods of an Activity in a Fragment, however I am not succeeding, someone can tell me if it is possible? public class updateMarker extends Activity { TextView uid; //URL to…
-
2
votes1
answer99
viewsRadio Button does not change text
I created a simple project, and I realized that the RadioButton does not change the text when rotating the screen. I created 2 functions a call setText() and the other setText2() with different…
-
2
votes1
answer1139
viewsHow to create a class with a Navigationdrawer to use in multiple Activities?
I started studying Android development a little while ago, I saw that to use a Navigationdrawer the recommended is to use fragments to change a Framelayout in the main Activity, but in the new…
-
2
votes2
answers410
viewsAndroid - Transfer Data and Change Fragment by Click
Hi guys. I need help to transfer from Fragment when I click my button inside a Listview. Currently I have a Mainactivity (extends Appcompatactivity) to manage the Fragments. Below are some images of…
-
2
votes2
answers1454
viewsCalling a new Activity through a Fragment
I have the following code: Fragment: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View i =…
-
2
votes1
answer885
viewsChange Fragment components through an Activity
I’m making an application with NavigationDrawer, and not to create another activity, I’m using fragments, where every click replace in the FrameLayout that I left set as main. How I access the…
-
2
votes1
answer47
viewsFragment being used by two different activties
I have a Ragment that is inflating a Recycler view, so far so good. The problem is that this Fragment needs to inflate into two different Rawer navigation, and when it comes to casting, I can only…
-
2
votes1
answer365
viewslistview with text image and subtitle
I’m building a sales app where a user will publish their product with: image, price, description and value. I can list the photo all right but I can’t put a title and the other descriptions Here’s…
java android listview android-fragment android-adapterasked 7 years, 11 months ago Felipe Moreira 25 -
2
votes1
answer65
viewsHow to send a json of an Activity to a Fragment?
I have an Activity that is added a data in Jsonobjetct. And as seen in the following code, I take it as a string, but, my doubt, as I by this Jsonobject in the fragment so that I can work with it,…
-
2
votes1
answer438
viewsConvert Activity to Fragments
Hello, I’m in need of a lot of help, I’m developing an application for my TCC, I’ve assembled most of the features and now that I’ve been messing with the visual part I’ve had problems, I mounted…
android android-studio android-fragment android-activityasked 7 years, 8 months ago Projeto Bentotec 63