Joseph_Marzbani
Joseph_Marzbani

Reputation: 1876

Why doesn't eclipse complain about this deprecated method?

In my manifest.xml I have defined:

    <uses-sdk android:minSdkVersion:"8" android:targetSdkVersion:"8" />

and in android's documentation for View class it's been said:

    setBackground(Drawable) 
    // ADDED IN API LEVEL 16

This method has been added in api level 16. But when I use it in my code, eclipse doesn't issue any complaint and my app crashes on devices running api under 16.

Where am I wrong?

Upvotes: 1

Views: 80

Answers (3)

donfuxx
donfuxx

Reputation: 11321

You could configure your project's Android Lint preferences like this:

  1. go to project --> properties --> Android Lint Preferences
  2. Set NewApi to severity error
  3. Click Apply button

enter image description here


then it should underline the setBackground method red and mark it as an error. That works for me in my project.

Upvotes: 2

user692168
user692168

Reputation:

You are compiling against a version higher than 16. Go to your project.properties file at the root of your project and change the line target=android-someNumber to target=android-8.

Upvotes: 0

Philip
Philip

Reputation: 1078

you probably target Version 8 but compile with 19.

Upvotes: 3

Related Questions