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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With