Sarvesh Thiruppathi
Sarvesh Thiruppathi

Reputation: 275

How to Create a LayoutInflator?

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

Answers (1)

xinaiz
xinaiz

Reputation: 7788

LayoutInflater is abstract class, so you can't just create it. You should use utility function LayoutInflater.from(context).

Upvotes: 3

Related Questions