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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:49:11+00:00 2026-05-24T19:49:11+00:00

I am trying to access some DisplayMetrics data and everything is returning zero. This

  • 0

I am trying to access some DisplayMetrics data and everything is returning zero. This is how I am initializing display metrics object:

DisplayMetrics display = new DisplayMetrics();

and when I call display.heightPixels it’s just zero. Do I need a permission or something to access DisplayMetrics?

  • 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-24T19:49:12+00:00Added an answer on May 24, 2026 at 7:49 pm

    This is not how to use DisplayMetrics.

    This is how:

    final WindowManager w = (WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE);
    final Display d = w.getDefaultDisplay();
    final DisplayMetrics m = new DisplayMetrics();
    d.getMetrics(m);
    
    // m now contains reliable data
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to transfer some data from Access to SQL Server 2000 (there are
I have some xml data and I am trying to access some elements. The
I'm trying to access some custom data emitted into an SVG document by Visio
I'm trying to access information within a Graph object in Mathematica 8. For some
been wrestling with this for some time. I am trying to access a REST
I'm trying to access an element called raw data, inside some <rawData>data is here</rawData>
I am trying to get some data to display from an Array in Cakephp,
I've been trying to access some XML, which looks like this: <feed xmlns:s=http://syndication.nhschoices.nhs.uk/services xmlns=http://www.w3.org/2005/Atom>
How delphi7 access C# .net managed dll ? i'm trying to access some DLL
I am trying to use Python's ctypes library to access some methods in the

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.