Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8925775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:47:28+00:00 2026-06-15T07:47:28+00:00

While we’re at it, what is the Android equivalent of [UIScreen mainScreen].scale ? Are

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:47:29+00:00Added an answer on June 15, 2026 at 7:47 am
    [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 1024×768 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 1024×768 (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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While working on Hadoop Implementation in Pseudo-Distributed Operation, I found following exception of JAVA_HOME
While learning on anonymous methods, i've found the following example on the internet: namespace
While working with annotations I stumbled accross the following piece of code (it's the
While running a makefile in gcc 4.1.2 (linux 5), I got the following error
While running 'rvm install 1.9.3' I get the following error: Error running ' ./configure
While programming with python I am often confused with the following ambiguity: should it
While I'm developing Android-Apps I like to have a look at internal SDK implementations.
While I was reading this tutorial on monads, found the following expression. data M
While going through university and from following the development of SO, I've heard a
while trying to insert data i am getting this error 07-29 18:15:19.909: E/sqlite(863): android.database.sqlite.SQLiteException:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.