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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:41:21+00:00 2026-05-15T18:41:21+00:00

I think I might be about to ask a dummy question, but I’m still

  • 0

I think I might be about to ask a dummy question, but I’m still new with Android programming, and I couldn’t (despite all my efforts) find my answer on Google.

The thing is, I’m trying to develop a little game, with 2D Graphics. I want my “gaming board” to be at a specific position on my screen, so that I can display in-game informations above and below the box. But since there is beginning to be a lot of Android phones out there, I was thinking about getting “dynamic” values so that I can adapt my font size to every device.

My game is not in full screen (but it could be, it’s no big deal), but in a window with no title bar.

I’m using an extension of the default SurfaceView class, implementing SurfaceHolder.Callback. I tried writing the following method :

public void getViewSize()
    {
        VIEW_WIDTH = this.getWidth();
        VIEW_HEIGHT = this.getHeight();
    }

but the values returned are zeroes.

Anyone got an idea (even if it means changing display strategy) ?
Thanks a lot.

  • 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-15T18:41:21+00:00Added an answer on May 15, 2026 at 6:41 pm

    You can do this:

    public void onDraw(Canvas canvas) {
      VIEW_WIDTH = canvas.getWidth();
      VIEW_HEIGHT = canvas.getHeight();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You might think that this question is already answered. However, I couldn't find the
This question is about a whole class of similar problems, but I'll ask it
I have an issue that (I think) might have to do with scope, but
I think it might have been asked before but i was unable to find
I think I might be overtired but I cannot for the life of me
G'day, While having a think about this question here about overdesigning for possible future
First of all, other questions about usage of sscanf do not answer my question
I feel a little stupid asking this question, but I hope that this might
With MS ramming powershell into all new server products, I'm starting to (reluctantly) think
this is surely a basic question for most of you but it still giving

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.