Skip to content

Instantly share code, notes, and snippets.

@milessabin
Created January 27, 2012 00:11
Show Gist options
  • Save milessabin/1686056 to your computer and use it in GitHub Desktop.
Save milessabin/1686056 to your computer and use it in GitHub Desktop.
case class ServiceId[T](id : Int)
implicit val lisServiceId =
ServiceId[android.view.LayoutInflater](Context.LAYOUT_INFLATER_SERVICE)
def service[T](implicit sid: ServiceId[T]): T = {
context.getSystemService(sid.id).asInstanceOf[T]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment