Is there any difference between these two?
inflater = (LayoutInflater) LayoutInflater.from(context);
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Not at the present time, as you can see by examining the LayoutInflater
source code. from()
will throw an Exception
rather than returning null
, but otherwise they are identical.
Personally, I use getLayoutInflater()
most times.
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