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 4023018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:32:50+00:00 2026-05-20T10:32:50+00:00

I was trying to get the screen resolution of android phones,using this code DisplayMetrics

  • 0

I was trying to get the screen resolution of android phones,using this code

    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    str_ScreenSize = dm.widthPixels + " x " + dm.heightPixels;
    str_ScreenSize = "dd" + " x " + dm.heightPixels;

When i tried this code in my Galaxy S phone i got the screen resolution as 320×533 px, but in reality the Galaxy S got a screen resolution of 480×800 px. So what’s wrong with the code??

How can i get the actual screen resolution of a particular device??

  • 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-05-20T10:32:51+00:00Added an answer on May 20, 2026 at 10:32 am

    Finally after 2 days of searching and testing, i finally managed to find out what’s the real issue here..
    All those above coding will give correct resolution. But the most important this is that we need to mention the target SDK in the manifest file.. Otherwise it will give wrong result if the density is more than 1.

    <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8" />
    

    need to set the targetSDK version from anything between 4-9..
    Hope this will help some one in future facing the same issue.

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

Sidebar

Related Questions

I'm trying get values from a GridView using the following code: foreach (GridViewRow row
I'm new at java and OpenGL. I'm trying to get a camera preview screen
I'm trying to get some ideas about how to develop a web login screen.
I am trying to get center of parent form, not center of screen behavior.
Trying to get my css / C# functions to look like this: body {
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
Just trying to get my head around Generics by reading this enlightening article by
I'm following this tutorial: http://www.javascripttoolbox.com/jquery/ And I'm trying to get table rows that are
I'm trying to get the background of my splash screen to be opaque/transparent. I
I have been trying to get the Fusion Charts to work on Android 2.2

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.