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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:38:39+00:00 2026-05-27T11:38:39+00:00

Android has a way to set the home screen wallpaper. The user taps menu

  • 0

Android has a way to set the home screen wallpaper. The user taps “menu” and then selects “wallpaper” to set a wallpaper from the system. The resulting wallpaper image is properly scaled in both portrait and landscape mode.

I did a small app that allows the home screen wallpaper to be changed. It works fine but I can’t find out what the secret is to get the image to be the correct size after it’s set as a wallpaper.

I did this with png images that are 1280×1084 and also tried the same thing with images that are 320×240 and they all are shown the same size when set as a home screen wallpaper.

I looked for tutorials and examples on how to set a wallpaper like they do, but couldn’t find out how to do it. Can you show me a code sample showing me the secret to this so the resulting wallpaper is scaled correctly?

I’m sure there must be some kind of WallpaperManager setting to use but I don’t know which one to use.

Thanks in advance.

Here’s the code I’m using to set the wallpaper:

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    WallpaperManager myWallpaperManager = WallpaperManager
            .getInstance(getApplicationContext());

    try {
        myWallpaperManager.setResource(R.drawable.kabanight1);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

Truly,
Emad

  • 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-27T11:38:39+00:00Added an answer on May 27, 2026 at 11:38 am

    I was just looking at this. While you can observe actual file sizes from wallpaper images in the Launcher .apk, a better way is to query the WallpaperManager for the desired size (which is independent of orientation).

    final WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);
    final int fullWidth = wallpaperManager.getDesiredMinimumWidth();
    final int fullHeight = wallpaperManager.getDesiredMinimumHeight();
    

    At this point, I create a new bitmap of the exact required size and write my own bitmap into it. The tricky part is calculating padding and scaling, as well as accounting for the status bar. However, once you write this properly-sized image as a wallpaper, it should work exactly like a system wallpaper.

    Now the downside – that image (with dimensions larger than your screen) is scaled properly, but you’ll note that it is cropped differently depending on your orientation.

    I think you’d need a live wallpaper if you wanted to resize the image depending on orientation (to maximize the size of the image but not crop it).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can we set Title for a Menu Item in Android if it has an
In order for the user to control the volume , my android application has
I'm currently writing a live wallpaper for Android and it has a PreferenceScreen which
I have a TextView in my android application that has a set width on
I'm working on an android app that has to send and receive information from
I want to create a set of objects which inherit from some Android View
I am new to Android dev. The way I have been handling clicks has
Sipdroid on Android has a search & replace method, that uses regex. I'm trying
R class on android has it's limitations. You can't use the resources dynamically for
I know that Android has a JSON parser baked in but I was wondering

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.