-10

I want to extend my class with 2 other classes Fragment and Activity. I tried this:

public class Frist extends Fragment , Activity 
{
      .....
      .....
}

But it's not working. How can I fix it?

krystian71115
  • 1,927
  • 17
  • 36

3 Answers3

1

You should use decorator or composition pattern

Tkachuk_Evgen
  • 1,334
  • 11
  • 17
1

You can't extend multiple classes. Why you can't extend fragment in another class?

krystian71115
  • 1,927
  • 17
  • 36
1

Java does not support multiple inheritance
Fragment and activity both are completely different thing.
If your want to make activity having fragment over it then in android studio create project with Activity with Fragment instead of with Blank activity
Then Automatically android studio will provide with some code having fragment and classes and xml for it.

kartikag01
  • 1,539
  • 1
  • 18
  • 36