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

  • Home
  • SEARCH
  • 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 6209095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:55:23+00:00 2026-05-24T05:55:23+00:00

When I get the screen size for my Android app, it returns a variable

  • 0

When I get the screen size for my Android app, it returns a variable which in every case is too large for the screen to display. I use the following code to get screen size.

final int windowHeight = getResources().getDisplayMetrics().heightPixels;
final int windowWidth = getResources().getDisplayMetrics().widthPixels;

Is there any way to compensate for it? Or to even fix my problem?

Also, is there a way to turn the battery/time bar off in the app? I think that might be the reason I’m having trouble, but I don’t actually know. That’s why I am asking.

  • 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-24T05:55:24+00:00Added an answer on May 24, 2026 at 5:55 am

    To disable the battery/time bar, I use this in my AndroidManifest.xml file, for the <application> tag :

    <application 
        android:icon="@drawable/icon" 
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar" 
        ...
        >
    

    And, to get the screen’s size, here’s what I have in my Activity :

        Display display = getWindowManager().getDefaultDisplay(); 
        int screenWidth = display.getWidth();
        int screenHeight = display.getHeight();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With Screen.DesktopHeight and Screen.DesktopWidth, I can get the size of the virtual desktop and
When I start my application initially, I get a black screen which stays for
I want to get the dimensions of the main screen, so I use this
I am trying to get Google Admob advertisements to display on the main screen
According to this doc page , Android 2.3 supports extra large screen sizes (xlarge),
The webserver wants to get info like screen size from each mobile handset that
Hi I am trying yo get the screen size of screen minus the menu
How do I programatically get the screen resolution on WP7? Here are a bunch
On iPhone, how do I show a login screen to get username and password
I want to capture the screen in my code to get an image -

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.