title: Android Kotlin StringRes quantityString
body: <p>Ok so this:</p>
  
  <pre><code>fun Context.quantityFromRes(id_: Int, qtt:Int, vararg format: Any) = resources.getQuantityString(id_, qtt, format)
  </code></pre>
  
  <p>xml:</p>
  
  <pre><code>&lt;plurals name="header_view"&gt;
          &lt;item quantity="one"&gt;Oh no! You just lost %1$d Point&lt;/item&gt;
          &lt;item quantity="other"&gt;Oh no! You just lost %1$d Points&lt;/item&gt;
      &lt;/plurals&gt;
  </code></pre>
  
  <p>Gives this error: </p>
  
  <pre><code>"java.util.IllegalFormatConversionException: %d can't format [Ljava.lang.Object; arguments"
  </code></pre>
  
  <p>Apparent Java fix:</p>
  
  <pre><code>public class XmlPluralFormatter {
      private XmlPluralFormatter() {
          throw new IllegalStateException("You can't fuck me =(");
      }
  
      public static String getFormattedString(Context context, int stringRes, int qtt, Object... formatArgs){
          return context.getResources().getQuantityString(stringRes,qtt, formatArgs);
      }
  
      public static String getFormattedString(Context context, int stringRes, int qtt){
          return context.getResources().getQuantityString(stringRes,qtt);
      }
  }
  </code></pre>
  
  <ul>
  <li>I just realised using this via Java would solve the problem, but i have no idea if there is a Kotlin way of accomplish the same.</li>
  </ul>
  
  <p>PS: Forgot the call:</p>
  
  <pre><code>val qtt: Int = 123
  context.quantityFromRes(R.plurals.header, qty)
  </code></pre>
  
  <p>I can also do this:</p>
  
  <pre><code>fun Context.quantityFromRes(id_: Int, qtt:Int, vararg format: Object) = resources.getQuantityString(id_, qtt, format)
  </code></pre>
  
  <p>but then</p>
  
  <pre><code>Required Object, found Int
  </code></pre>
  
  <p>I can also cast:</p>
  
  <pre><code>context.quantityFromRes(R.plurals.header, qty, qt as Object)
  </code></pre>
  
  <p>but also gives:</p>
  
  <pre><code>"java.util.IllegalFormatConversionException: %d can't format [Ljava.lang.Object; arguments"
  </code></pre>
  
  <p>Also, using code directly without an extension function works:</p>
  
  <pre><code>context.resources.getQuantityString(R.plurals.header, qtt, qtt)
  </code></pre>