I Am Getting Cannot Create Instance Of Abstract Class In Kotlin Warning?
I am a new to Kotlin. I have two classes, one adapter and one fragment. When I want to call the adapter class in fragment I am getting the following warning: cannot create an insta
Solution 1:
You can't create instance of an abstract class. You should remove abstract from the class declaration, or you should create new class extending the abstract class and make instances of that class.
Solution 2:
From your problem i can guess that FavoriteExerciseAdapter
is abstract. you need to add a new concrete class to your project for example name it MyFavoriteExerciseAdapter
. MyFavoriteExerciseAdapter
must extends FavoriteExerciseAdapter
and overrids all abstract methods of FavoriteExerciseAdapter
now instantiate MyFavoriteExerciseAdapter
instead of FavoriteExerciseAdapter
:
var adapter: FavoriteExerciseAdapter = MyFavoriteExerciseAdapter()// instantiate MyFavoriteExerciseAdapter
Post a Comment for "I Am Getting Cannot Create Instance Of Abstract Class In Kotlin Warning?"