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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:11:07+00:00 2026-06-17T17:11:07+00:00

Good morning I have a code that works right to set wallpapers which was

  • 0

Good morning
I have a code that works right to set wallpapers which was downloaded from net at a size of 1024 x 768 in jpg
when I set a wallpaper, this is distributed to all homescreens but from android 4+ they are not scrollable, putting a part of the image fixed for all homescreens
I would like to solve the problem so I hope you could help me

greetings and sorry for me english

//path is a String with image's url
public int setWallpaper(String path) {          
    int width, height;
    Bitmap dbm, bm;         
    bm = null;
    dbm = null; 
    InputStream is = null;

    WallpaperManager wpm = wallpaperManager.getInstance(this);              

    //all images are 1024x 768 
    //to scale bitmap the widht have to be 1.33 bigger than screen's height
    if((wpm != null) && (dis != null)){ 
        height = dis.getHeight();
        width = (int) (height * 1.33);              

        try {           
            URLConnection conn = new URL(path).openConnection();                
            conn.connect();             
            is = conn.getInputStream();                 

            if (is != null) {                   
                bm = BitmapFactory.decodeStream(new FlushedInputStream(is));                    
                dbm = Bitmap.createScaledBitmap(bm, width, height, false);                  
                wpm.setBitmap(dbm); 

            }else {
                return 2;
            }

        } catch (MalformedURLException e) {                 
            e.printStackTrace();                
        } catch (IOException e) {               
            e.printStackTrace();                
        } finally {             
            if (is != null) {
                try {
                    is.close();
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }           
        if(bm != null){
            bm.recycle();
        }
        if(dbm != null){
            dbm.recycle();  
        }           
    }else {
        return 1;
    }
    return 0;
}
  • 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-17T17:11:08+00:00Added an answer on June 17, 2026 at 5:11 pm

    They are no longer scrollable on android 4, however, to avoid them being zoomed in, you can do the following:

    // get screen dimensions
    DisplayMetrics displaymetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int height = displaymetrics.heightPixels;
    int width = displaymetrics.widthPixels;
    
    wpm.suggestDesiredDimensions(width, height);
    wpm.setBitmap(dbm);
    

    By using suggestDesiredDimensions you specify the size of the wallpaper.

    From the developer reference:

    public void suggestDesiredDimensions (int minimumWidth, int
    minimumHeight)

    Since: API Level 5 For use only by the current home application, to
    specify the size of wallpaper it would like to use. This allows such
    applications to have a virtual wallpaper that is larger than the
    physical screen, matching the size of their workspace.

    Note developers, who don’t seem to be reading this. This is for home
    screens to tell what size wallpaper they would like. Nobody else
    should be calling this! Certainly not other non-home-screen apps that
    change the wallpaper. Those apps are supposed to retrieve the
    suggested size so they can construct a wallpaper that matches it.

    Remember you will also need to request the SET_WALLPAPER_HINTS permission on your manifest by doing:

    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good Morning, I have created an ASP.NET 3.5 webform that allows users to search
Good morning, I have to use the properties from DeviceNetworkInformation in my application. (http://msdn.microsoft.com/en-us/library/microsoft.phone.net.networkinformation.devicenetworkinformation(v=vs.92).aspx)
Good morning. I have the next code which put some markers in a map
Good morning to everybody, :) I have writen a code in C++ that reads
Good morning, mysql query which displays cases that have a date field completed &
good morning programers, I have this small code which content a news control panel
Good Morning All, I have inherited an ASP.net website that was originally started back
Good Morning All, I have an Objective C question that is coming from JavaScript.
Good morning gang. I have a jQuery Datepicker object that is prepoulated using a
Good Morning, I'm working on an ASP.NET 3.5 webforms application and have written the

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.