Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program untuk tau tablet atau phone
- DisplayMetrics metrics = new DisplayMetrics();
- this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
- float yInches= metrics.heightPixels/metrics.ydpi;
- float xInches= metrics.widthPixels/metrics.xdpi;
- double diagonalInches = Math.sqrt(xInches*xInches + yInches*yInches);
- Log.d("xxx", "Ini Apa :" + diagonalInches);
- if (diagonalInches>=6.5){
- Log.d("xxx", "Ini Tablet :" + diagonalInches);
- }else{
- Log.d("xxx", "Ini phone :" + diagonalInches);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement