Question: While we're at it, what is the Android equivalent of `[UIScreen mainScreen].scale`?

Are the following equations correct?

```
[UIScreen mainScreen].bounds.size.width = displayMetrics.widthPixels
[UIScreen mainScreen].scale = displayMetrics.density

```

where you get `displayMetrics` like so:

```
DisplayMetrics displayMetrics = new DisplayMetrics();
Display display = ((WindowManager) someContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getMetrics(displayMetrics);

```

The thing is that I'm confused by the wording for iOS versus Android.

The definitions for those UIScreen values are these:

> 
> **bounds**
> 
> 
> Contains the bounding rectangle of the screen, measured in points.
>  (read-only)
> 
> 
> **scale**
> 
> 
> The natural scale factor associated with the screen. (read-only)
> 
> 
> @property(nonatomic, readonly) CGFloat scale
> 
> 
> Discussion
> 
> 
> This value reflects the scale factor needed to convert from the
>  default logical coordinate space into the device coordinate space of
>  this screen. The default logical coordinate space is measured using
>  points, where one point is approximately equal to 1/160th of an inch.
>  If a device’s screen has a reasonably similar pixel density, the scale
>  factor is typically set to 1.0 so that one point maps to one pixel.
>  However, a screen with a significantly different pixel density may set
>  this property to a higher value.
> 
> 
> 

I am wondering whether the width of the bounds is equivalent to the widthPixels of the DisplayMetrics and whether the scale value is equivalent to the density value on Android.

Answer: 
```
[UIScreen mainScreen].bounds.size.width = displayMetrics.widthPixels
```

Correct, width of the screen (display) in pixels, nothing complicated here.

```
[UIScreen mainScreen].scale = displayMetrics.density
```

Not really. They are similar values but definitely not equal.

I'll try to explain what `scale` is. We have iPad 1 with screen resolution 1024x768 and we have iPad 3 with double resolution (apple marketing calls it Retina) and we want applications to work on both devices. So, the application works on resolution 1024x768 (logical points) but the OS translates to physical pixels on every device using the scale (scale=1.0 on iPad 1, scale=2.0 on iPad 3).
For example, when you draw a rectangle in logical coordinates (1, 1, 20, 40), on iPad 3 it will be drawn on pixels (2, 2, 40, 80).

There are currently only two values defined: `1.0` and `2.0`.

The density is a similar scaling factor but calculated differently 

> 
> This is a scaling factor for the Density Independent Pixel unit, where one DIP is one pixel on an approximately 160 dpi screen 
>  Note that again it converts logical points (called DIP on Android) into screen pixels.
> 
> 
> 

The difference between iOS scale and Android density is that the logical unit is defined differently.
I use this:

```
    private void SetScreenSizes() {
        DisplayMetrics displaymetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
        intScreenWidth = displaymetrics.widthPixels;
}

```