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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:39:17+00:00 2026-06-15T10:39:17+00:00

I just upgraded my Android project’s build target to API 17, and I’m now

  • 0

I just upgraded my Android project’s build target to API 17, and I’m now getting warnings about setBackgroundDrawable being deprecated. The answer appears to be to use setBackground, but that’s not available in older versions.

Is there any actual advantage to using the new method, or did Google just want to change the name? I don’t see any point in complicating my code with platform version checks or reflection if the two work the same.

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

    Is there any actual advantage to using the new method, or did Google just want to change the name?

    They seemed to only want to change the name, look at the source code:

    public void setBackground(Drawable background) {
        //noinspection deprecation
        setBackgroundDrawable(background);
    }
    
    @Deprecated
    public void setBackgroundDrawable(Drawable background) { ... }
    

    All of the work is still done in setBackgroundDrawable(). For now, you can ignore the deprecation warnings but understand that in some future API setBackgroundDrawable() will be removed.


    In case you are curious, setBackgroundResource(int resid) simply creates a drawable from the resource ID and calls setBackground() (which again calls setBackgroundDrawable())…

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

Sidebar

Related Questions

I just upgraded packages in an MVC 3 project (ASP.net 4), and now I
Having just upgraded to iOS 4.1 (Xcode 3.2.4) I am getting warnings when using
I just upgraded to Mono for Android version 4.2. Since then I am getting
I just upgraded my Android SDK, ADT and Proguard to the latest and greatest.
I just upgraded to the latest version of the SDK (version 19) and now
I just upgraded from SnowLeapord to Lion and now cannot create virtualenvs. I understand
Just upgraded to iPhone sdk4 and getting a lot of errors in my iPhone
I've just upgraded my Android dev env up to v15 and I'm unable to
I just upgraded to the Android 2 SDK . (I was at v1.5 )
I just upgraded a VS 2005 project to VS 2008 and was examining 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.