Successfully created and wrote to new file: /home/Messier82/projects/service-book/app/src/main/java/com/servicebook/ui/util/ContextExtensions.kt. Here is the updated code: package com.servicebook.ui.util import android.app.Activity import android.content.Context import android.content.ContextWrapper fun Context.findActivity(): Activity? { var ctx: Context? = this while (ctx is ContextWrapper) { if (ctx is Activity) return ctx ctx = ctx.baseContext } return null }