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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:46:40+00:00 2026-06-04T11:46:40+00:00

I am trying to detect 7 tablets in my code (i.e. Kindle Fire &

  • 0

I am trying to detect 7″ tablets in my code (i.e. Kindle Fire & Nook Color). However, simply testing for minimum dimensions 1024×600 is not good, because then the Galaxy Nexus would pass this test as well. Anybody has experience with detecting this kind of information?

Thanks,
Igor

EDIT:
I have found one way to detect Kindle Fire & Nook Color devices with the following code:

Activity activity = (Activity) activityContext;
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = activity.getWindowManager().getDefaultDisplay().getWidth();
int height = activity.getWindowManager().getDefaultDisplay().getHeight();
if ((width == 1024 && height == 600) || (width == 600 && height == 1024)) {    
        //Detects 7" tablets: i.e. Kindle Fire & Nook Color
        isTablet = true;
    }
  • 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-04T11:46:41+00:00Added an answer on June 4, 2026 at 11:46 am

    To calculate the height and width of the device (in inches) you can use the following code.

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    
    float widthInInches = metrics.widthPixels / metrics.xdpi;
    float heightInInches = metrics.heightPixels / metrics.ydpi;
    

    Then the size can be calculated

    double sizeInInches = Math.sqrt(Math.pow(widthInInches, 2) + Math.pow(heightInInches, 2));
    //0.5" buffer for 7" devices
    boolean is7inchTablet = sizeInInches >= 6.5 && sizeInInches <= 7.5; 
    

    As per Commonsware suggestion above, a potentially faster, but less obvious implementation.

    double sizeInInchesSquared = (widthInInches * widthInInches) + (heightInInches * heightInInches);
    //0.5" buffer for 7" devices (6.5^2 = 42.25) (7.5^2 = 56.25)
    boolean is7inchTablet = sizeInInchesSquared >= 42.25 && sizeInInchesSquared <= 56.25; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to detect the compiler used to compile my source code. I can
I'm trying to detect with javascript if my website is running on a kindle
I am trying to detect the browser in my C# code by comparing the
I'm trying to detect an occurrence of a string within string. But the code
I am trying to detect objects with cvblob. Somehow, my code only marks the
I'm trying to detect emoji in my php code, and prevent users entering it.
Trying to detect left click vs right click (without using jQuery!) and I have
I'm trying to detect Use after free() bugs, otherwise known as Dangling pointers. I
I'm trying to detect the position of the browser's scrollbar with JavaScript to decide
I'm trying to detect the browser's current size (width and height). I know it's

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.