You can also write this as:
LayoutInflater inflator = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflator.inflate(R.layout.yourxmllayout, null);
If you are in action, there is no need to use context.
source
share