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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:39:04+00:00 2026-06-07T10:39:04+00:00

how to write the code that read the size of the screen. i have

  • 0

how to write the code that read the size of the screen. i have 4 different layout, “layout”, “layout-land”, “layout-large”, and “layout-large-land”

every one of the layout i need to write a different code for each of them, for example at the “layout” , i have this code imagebutton1.setVisibility(View.VISIBLE); , but at the landscape screen, i have remove the imagebutton1. so i plan to if else statement, but i duno how to determine the size of the screen by using android java, need some guide here.

  • 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-07T10:39:07+00:00Added an answer on June 7, 2026 at 10:39 am

    Technically, you could just do something like this:

    ImageButton imageButton = findViewById(R.id.image_button);
    
    if (imageButton1 != null) {
        // if the imagebutton isn't found in the view hierarchy,
        // then don't attempt to manipulate it.
        imagebutton1.setVisibility(View.VISIBLE);
    }
    

    Otherwise you can use:

    Configuration conf = getResources().getConfiguration();
    
    boolean isLarge = (conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == 
                          Configuration.SCREENLAYOUT_SIZE_LARGE;
    
    boolean isLandscape = (conf.orientation == Configuration.ORIENTATION_LANDSCAPE);
    
    boolean isLargeLand = isLarge && isLandscape;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes I have to write code that alternates between doing things and checking for
I need to write some code that would loop though all rows of a
I write a code that read a png image from file and show with
I m trying write code that after reset set up rrpmax as 3000. It
I'm trying to write code that will load an image from a resource, and
I've been trying to write code that loads a .png file, attaches hotspot information,
Sometimes while writing Java in Eclipse, I write code that generates warnings. A common
I'm trying to write a code that adds a class to a div for
I am trying to write some code that will generate accurate .proto files from
I'm trying to write a code that could print something like this -xv -xvv

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.