Issue
I get the error:
Expecting member declaration
class MyAdapter(val context: Context) {
constructor(context: Context, itemInfos: List<ItemInfo>): RecyclerView.Adapter<ContentItemViewHolder> {
}
}
What am I doing wrong?
Solution
Do something like this:
class MyAdapter(val context: Context): RecyclerView.Adapter<ContentItemViewHolder>() {
constructor(context: Context, itemInfos: List<ItemInfo>): this(context) {
}
}
If you inherit from another class you should specify it in class declaration, not constructor declaration.
Answered By - Sergey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.