As hdemirchian said, make sure to use:
import android.support.v4.app.Fragment;
And also make sure that the Activity that is using the fragment(s) extends FragmentActivity
instead of the regular Activity
,
import android.support.v4.app.FragmentActivity;
to get the FragmentActivity
class.
More Related Contents:
- Can anyone solve my Android Fragment issue? [closed]
- My list view is lagging can anyone help me to fix this?
- How to implement a ViewPager with different Fragments / Layouts
- How do I get the currently displayed fragment?
- How do I make WRAP_CONTENT work on a RecyclerView
- Why fragments, and when to use fragments instead of activities?
- Error while Running Android Application – Could not initialize OpenglES emulation, use ‘-gpu off’ to disable it
- Adding button action in custom notification
- Hide/Show bottomNavigationView on Scroll
- Difference between onCreateView and onViewCreated in Fragment
- getView returning null when fragment has been created from an activity
- FragmentContainerView using findNavController
- How to wrap the height of a ViewPager to the height of its current Fragment?
- One Activity and all other Fragments [closed]
- fitsSystemWindows effect gone for fragments added via FragmentTransaction
- Position of DialogFragment in Android
- java.lang.NullPointerException: Attempt to invoke virtual method ‘int android.view.View.getImportantForAccessibility()’ on a null object reference
- java.lang.IllegalStateException: The specified child already has a parent
- application content goes behind the navigation bar in android L
- Switching between Fragment view
- Error inflating class android.support.design.widget.CoordinatorLayout and ClassNotFoundException: android.support.design.R$styleable
- In android how to set navigation drawer header image and name programmatically in class file?
- Menu like SKOUT and Sliding from One View to Another by touch in Android
- Disable multi finger touch in my app [duplicate]
- Placing ViewPager as a row in ListView
- Different tab width for TabLayout
- Stop fragment refresh in bottom nav using navhost
- IllegalStateException: Can’t change container ID of Fragment
- How to display both icon and title of action inside ActionBar?
- Ripple effect on Android Lollipop CardView