title: how to set a Bitmap to background for a view Android API 10-18?
body: <p>What I have is:</p>
  
  <p>Manifest:</p>
  
  <pre><code>&lt;uses-sdk
      android:minSdkVersion="10"
      android:targetSdkVersion="18" /&gt;
  </code></pre>
  
  <p>source:</p>
  
  <pre><code>View view = createViewFromWhatever();
  Bitmap bitmap = loadSomethingAddMore();
  </code></pre>
  
  <p>Everywhere I have searched this is the accepted, suggested:</p>
  
  <pre><code>view.setBackgroundDrawable(new BitmapDrawable(bitmap));
  </code></pre>
  
  <p>But it is Deprecated in API 18. I am terrorised with framework bugs and miss documentations at OS level. I want to respect what they are saying and in case of crash "it is not my fault"</p>
  
  <p>I can't even use the <code>new BitmapDrawable(bitmap)</code> and I  need <code>new BitmapDrawable(getActivity().getResources(), bitmap)</code> instead. If I change my method to a recommended way: <code>setBackground(new BitmapDrawable(getActivity().getResources(), bitmap));</code></p>
  
  <p>It will mark as error with message: </p>
  
  <blockquote>
    <p>Call requires API level 16 (current min is 10):
    android.widget.RelativeLayout#setBackground</p>
  </blockquote>
  
  <p>As a solution I could check what version is running the user and do an if-else than I will have a code will with <code>if(isAndroidVersion10()) else if () ...</code></p>
  
  <p>Any solution acceptable solution?</p>
  
  <p>If I escape from deprecation warnings via reflection I still will have the responsibility in case of crash, because I have release the code with deprecated method! -just the way how I call is different.</p>
  
  <p>If I ignore that Lint, than it will crash at a low version api, tested.</p>
  
  <p>Ofc  I want to support API 10 , so can't accept most of answers from <a href="https://stackoverflow.com/questions/14357344/call-requires-api-level-14-current-min-is-10">here</a></p>