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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:38:23+00:00 2026-06-17T19:38:23+00:00

I have an app that creates shortcuts. it generates the shortcut icon dynamically, so

  • 0

I have an app that creates shortcuts. it generates the shortcut icon dynamically, so I need to know the correct launcher icon size.

To handle this, I created dimens.xml in values-ldpi/mdpi/hdpi/xhdpi/xxhdpi and defined my icon size to be 36/48/72/96/144px respectively.

This scheme works, except on 10", xhdpi tablets (like the nexus 10). it appears these tablets use a launcher icon size of 144px (xxhdpi) despite have an xhdpi screen.

Is there a way to correctly detect the launcher icon size that takes into account 10" xhdpi tablets? Or is there a better scheme for getting my icons sized correctly? Or perhaps is there a way to differentiate this case from the simple xhdpi case?

  • 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-17T19:38:24+00:00Added an answer on June 17, 2026 at 7:38 pm

    To get the launcher icon size, simply call ActivityManager.getLauncherLargeIconSize() as suggested by CommonsWare above. One slight hiccup is that this is only available on API 11+. In that case, fall back to using DisplayMetrics. This will of course fail if there was a 10" XHDPI device that ran android 2, which is extremely unlikely (since X*HDPI didn’t exist at the time of Android 2). Here’s the utility method I wrote,

    @SuppressLint("NewApi")
    private int getLauncherIconSize() {
        int size = 48;
    
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            ActivityManager mgr = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
            size = mgr.getLauncherLargeIconSize();
        } else {
            DisplayMetrics metrics = new DisplayMetrics();
            activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
            switch (metrics.densityDpi) {
            case DisplayMetrics.DENSITY_LOW:
                size = 36;
                break;
            case DisplayMetrics.DENSITY_MEDIUM:
                size = 48;
                break;
            case DisplayMetrics.DENSITY_HIGH:
                size = 72;
                break;
            case DisplayMetrics.DENSITY_XHIGH:
                size = 96;
                break;
            case DisplayMetrics.DENSITY_XXHIGH:
                size = 144;
                break;
            }
        }
    
        return size;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Silverlight app I have an event handler that dynamically creates a new
I have a third-party app that creates HTML-based reports that I need to display.
I have an app that allows you to create Home shortcuts to a specific
I have an app that creates a variable number of ScatterviewItems based on which
I have an app that creates a SQLite database ( with 24 records ),
I have an app that creates a database and do some stuff. I am
currently I have an app that creates all sorts of different requests to Facebook
I have a PHP app that creates a CSV file which is forced to
I have an ASP.NET Login App that creates a cookie called 'ASP_LOGIN77' and gives
I have an app that displays a splash screen. The splash screen activity creates

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.