0

In my app, I created a new bitmap by crop or resize an available image in res/drawable folder, and I convert that bitmap to drawable. I know I can use setBackgroundDrawable for that drawable but it requires API 16, that's somehow to high for some devices. So how can I get intId of that drawble to use setBackgroundResource function?

dzuncoi
  • 31
  • 7
  • Maybe [this](http://stackoverflow.com/a/11947755/2668136) might help you. – Blo Apr 19 '14 at 19:34
  • Thank Fllo, you saved my day :-) By the way, to use `setbackgroundDrawable` I need to add suppress lint, does it affect my app further and why google need to do that? – dzuncoi Apr 20 '14 at 07:51
  • It's not an error, just a warning. It causes by the SDK and Java which say for lower api to not read this method to avoid possible exception. Your app can run without it. And be carefull on *what lines* are under the suppression. Don't suppress all your method because it will never read by any lower apis. I think you can put this on local methods. HTH – Blo Apr 20 '14 at 10:53

1 Answers1

1

setBackgroundDrawable is available from API 1

setBackground is available from API 16

michal.luszczuk
  • 2,883
  • 1
  • 15
  • 22