Reputation: 1330
So I am trying to inflate a layout in my activity but I keep getting this error "Cannot resolve method inflate(int)"
LayoutInflater layoutInflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View error = layoutInflater.inflate(R.layout.error_internet_connection);
What am I doing wrong?
Upvotes: 4
Views: 8960
Reputation: 157457
there is no method inflate(int)
. The methods available are inflate(int, ViewGroup)
and inflate(int, ViewGroup, boolean)
.
Change
View error = layoutInflater.inflate(R.layout.error_internet_connection);
to
View error = layoutInflater.inflate(R.layout.error_internet_connection, null);
Here you can find the documentation
Upvotes: 10