I have a problem where i should know the number of gridview
in each row which gets displayed for different devices. like number of gridview
per row
Try this method, getNumColumns();
This will provide you with the column count.
Usage:
gridView.getNumColumns();
Okk you can set number of columns programatically using
float scalefactor = getResources().getDisplayMetrics().density * 100;
int width = getWindowManager().getDefaultDisplay().getWidth();
int columns = (int) ((float)width / (float) scalefactor);
gridView.setNumColumns(columns);
where 100 is the fixed width of each column for all devices m taking...i get 8 columns in tablet,3 in samsung 2.2 devices and 4 in samsung note