title: Initialize database using kotlin in AsyncTask
body: <p>In my <code>doInBackground</code> I declare and Initialize db, I got an error which say type mismatch. What should I put instead of putting <code>this</code>?</p>
  
  <pre><code>var dbHelper: MyDBHelper? = null
  dbHelper = MyDBHelper(this)
  </code></pre>
  
  <p>What should I put, There say <code>Required: Context!</code></p>
  
  <p>And this is my async task code, That Problem at <code>dbHelper = MyDBHelper(this)</code>.</p>
  
  <pre><code>private class UpgradeDB(textView: TextView?) : AsyncTask&lt;String, String, String&gt;() {
          var innerTextView: TextView? = textView
  
          override fun onPreExecute() {
              innerTextView!!.visibility = View.VISIBLE
          }
  
          override fun doInBackground(vararg params: String): String? {
              val filename = "eBOSSInv_Upgrade.sql"
              val sdcard = Environment.getExternalStorageDirectory()
              val file = File(sdcard, filename)
  
              if (!file.exists()) isCancelled
  
              try {
                  var dbHelper: MyDBHelper? = null
  
                  dbHelper = MyDBHelper(this)
  
                  dbHelper!!.writableDatabase.use { db -&gt;
                      var intTotalLine = 0
                      var intLine = 1
                      BufferedReader(FileReader(file)).useLines { _ -&gt; intTotalLine++ }
                      BufferedReader(FileReader(file)).use { r -&gt;
                          r.lineSequence().forEach {
                              if (it.isNotEmpty()) {
                                  db!!.execSQL(it)
                                  publishProgress(String.format("Updating %s/%s records", intLine, intTotalLine))
                                  intLine++
                              }
                          }
                      }
                  }
              } catch (e: Exception) {
  
              }
              return null
          }
  
          override fun onProgressUpdate(vararg text: String) {
              innerTextView!!.text = text[0]
          }
  
          override fun onPostExecute(result: String?) {
              innerTextView!!.text = ""
          }
  
          override fun onCancelled() {
  
          }
      }
  </code></pre>