This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Fragment not recognised as a fragment  RSS feed

 
Stephen Black
Ranch Hand
Posts: 52
1
Chrome MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an inner class like so

but Line 12 isn't being recognised as a Fragment the exact error message is actually for line 10 which says
1. Multiple markers at this Line
2. the return type is incompatable

I thought that if a class extends Fragment then it would be a fragment so I checked the original class

and Yes it extends Fragment

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you importing and using the same Fragment class in both places? There's android.app.Fragment and there's android.support.v4.app.Fragment - which are incompatible to one another.
 
Stephen Black
Ranch Hand
Posts: 52
1
Chrome MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that it worked
NOTE TO SELF Do not reference a class that uses import x when the referencing class imports a compatibility version of x
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!