title: Kotlin extension function - How to make it global?
body: <p>I have created a Kotlin extension function on the Android <code>ViewGroup</code> class so that it can do layout inflation calls easier. So, here is my extension:</p>
  
  <pre><code>fun ViewGroup.inflate(layoutRes: Int): View {
      return LayoutInflater.from(context).inflate(layoutRes, this, false)
  }
  </code></pre>
  
  <p>and then I can use it like this in an adapter class to inflate a layout:</p>
  
  <pre><code> override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
      val v = parent.inflate(R.layout.view_item)
      return ViewHolder(v)
  }
  </code></pre>
  
  <p>I have declared this extension in the adapter class I am using for a RecyclerView so that it can make inflation calls easier. But I want ALL adapters or I should say all <code>ViewGroup</code> classes to see this extension. I want it permanent. </p>
  
  <p>It seems to just stick within where I declared it not globally.  Where should I declare this extension so that anytime I use a view group this method extension will be available?</p>