layoutmanager grid android code example
Example: android gridlayoutmanager
in res/values/dimens.xml:
<integer name="grid_columns">1</integer>
in res/values-w600dp/dimens.xml:
<integer name="grid_columns">2</integer>
in java:
int gridColumns = getResources().getInteger(R.integer.grid_columns);