-2

I am getting error from the following sentence

public class FirstFragment extends Fragment, AppCompatActivity implements AbsListView.OnScrollListener  {

I am not aware of any limit, what could be wrong?

MDR
  • 55
  • 7

1 Answers1

0

When you extend a class, you are basically saying "Start with Fragment, then apply my extension functionality over the top." Hence you cannot extend two distinct classes.

When you implement an interface, it is like saying "Add these connections to my class." So you can implement multiple interfaces in one class.

JstnPwll
  • 8,585
  • 2
  • 33
  • 56
  • aka the second class should be extended in the parent activity in the case of a Navigation Drawer, right? – MDR Nov 11 '15 at 22:45
  • Yes, your app's activity should extend `AppCompatActivity`, any custom fragments you're writing should extend `Fragment` (or `FragmentCompat`), etc. Each class can have exactly zero or one parents (super classes). – JstnPwll Nov 11 '15 at 22:47