2

I need to find my app running in 7 inches tab or 10 inches tab.How i can find it.please can any one help me.

Thanking in Advance.

seenu
  • 147
  • 1
  • 7

2 Answers2

2

Create a bool value in the values - sw600 and sw 720 as

in sw600 isSevenInch - true; isTenInch - false;

in sw720 isTenInch - true; isSevenInch - false;

and at runtime get the bool value and u can find that u required.

From Source

Community
  • 1
  • 1
Tamilselvan Kalimuthu
  • 1,534
  • 1
  • 13
  • 28
1

once try this

Display deviceDisplay = getWindowManager().getDefaultDisplay(); 
int width = deviceDisplay.getWidth();
int height = deviceDisplay.getHeight();

DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
double xPoints = Math.pow(dm.widthPixels/dm.xdpi,2);
double yPoints = Math.pow(dm.heightPixels/dm.ydpi,2);
double deviceScreenSizeInInch = Math.sqrt(xPoints+yPoints);
user1140237
  • 5,015
  • 1
  • 28
  • 56
  • How i can check is it running in 7 inches or 10 inches tab? – seenu Oct 08 '13 at 05:14
  • check updated ans jst nw checeked(in emulator) value for deviceScreenSizeInInch = 7.270660324187946 for 7 inch & for 10 inch it will gve value accordingly not exact 10 bt it will near by . int cast and all may req... hope ths will help – user1140237 Oct 08 '13 at 05:33