Reputation: 275
I used a constructor , But it doesn't work.
LayoutInflater layoutInflater = new LayoutInflater(getContext());
Android Studio Underlines the following code in red
new LayoutInflater(getContext());
and it says "LayoutInflator is abstract; cannot be instantiated.
Upvotes: 0
Views: 48
Reputation: 7788
LayoutInflater
is abstract class, so you can't just create it. You should use utility function LayoutInflater.from(context)
.
Upvotes: 3