Custom grid layout android code example
Example: android grid column
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);