Top "Fragment" questions

**DO NOT USE**: fragment is an ambiguous tag, used to refer to numerous technologies.

How to display AlertDialog in a Fragment?

I want to display an alert dialog in my app. I am using fragments. I tried the below code to …

java android fragment android-alertdialog android-context
How to inflate view inside fragment

If I try to inflate a view within a fragment I am getting NULL.. For example: public View onCreateView(LayoutInflater …

android android-fragments fragment
how to go back to previous fragment on pressing manually back button of individual fragment?

I have only one activity and multiple fragments in my application. Two main fragment A(left) and B(right). Fragment …

android fragment back
Fragment already added IllegalStateException

I use this method on my container Activity to show a BFrag public void showBFrag() { // Start a new FragmentTransaction FragmentTransaction …

android android-3.0-honeycomb android-fragments fragment illegalstateexception
Handling back button in Android Navigation Component

I'd like to know how properly handle system back button action using Navigation Controller. In my app I have two …

android navigation fragment android-jetpack
How to open navigation drawer on button click in main fragment?

I have made an app with one activity which uses a navigation drawer to open a number of different fragments. …

android fragment navigation-drawer
Set up toolbar as actionbar in fragment

I want to set up my toolbar as an actionbar, but since your toolbar is a layoutelement it has to …

java android android-actionbar fragment toolbar
How to access Activity Variables from a fragment Android

In the Activity I have : public class tabsmain extends Activity{ public static Context appContext; public boolean lf_ch=false; public …

java android android-activity fragment
Drag/Drop feature in Android studio not working

I'm new to android programming The drag/ and drop feature in android studio is not working. I can't drag anything …

android android-layout android-studio drag-and-drop fragment
Android: Change Background Color of Fragment

I tried changing the background color of a fragment, but a small problem occurred. public class MainActivity extends FragmentActivity { @Override …

android layout background fragment