title: Android getDrawable() Deprecated / How To use Android getDrawable()
body: <p>Can anyone tell me the right way of using getDrawable() , I recall last time I used it was just fine with one parameter, but now I am getting this method is deprecated error, anyone? Bellow is the snippet I am trying to use</p>
  
  <pre><code> private void toggleUi() {
      ImageView imageView = (ImageView) findViewById(R.id.silent_icon);
      Drawable silentImage;
  
      if(silent) {
          silentImage = getResources().getDrawable(R.drawable.silent_on);
      } else {
          silentImage = getResources().getDrawable(R.drawable.silent_off);
      }
      imageView.setImageDrawable(silentImage);
  }
  </code></pre>
  
  <p>Will be glad if anyone can help thanks.</p>