1

I am trying to make my fragments in my app in this case I follow one tutorial But I am stuck at this error

Dashboard.java

**Dashboard.java**

ViewPageAdapter

**ViewPageAdapter**

Error Log

App Crash Error Log

James Z
  • 12,209
  • 10
  • 24
  • 44
Usman
  • 87
  • 1
  • 3
  • 8
  • Your fragment "my_registration" extends class android.app.Fragment not android.v4.app.Fragment. Check https://stackoverflow.com/questions/15109017/difference-between-android-app-fragment-and-android-support-v4-app-fragment – MarcinR Jul 11 '18 at 11:07
  • post my_registration class – Saurabh Jul 11 '18 at 11:09
  • not understand where I make the mistake? – Usman Jul 11 '18 at 11:16
  • Please add your code & errors as text, not images. Images cannot be found with search functionality and are therefore quite often useless for other users. It might also be useful to add link to that one tutorial. – James Z Jul 11 '18 at 13:28

1 Answers1

0

Make sure my_registration extends Fragment and this fragment should be

import android.support.v4.app.Fragment

Add viewPager.setAdapter(adapter) after calling AddFragment method. like this:

adapter.AddFragment(..); // add first fragment 
adapter.AddFragment(..); // add second fragment
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
Suraj Vaishnav
  • 7,777
  • 4
  • 43
  • 46