title: Content provider return cursor in asynchronous way
body: <p>I have 2 android apps, the first one (written in Kotlin) provides data to the second app using content provider. How can I return cursor in query function asynchronously?</p>
  
  <pre><code>**In ContentProvider class**
  
   override fun query(p0: Uri, p1: Array&lt;String&gt;?, p2: String?, p3: Array&lt;String&gt;?, p4: String?): Cursor? {
          val cursor = MatrixCursor(arrayOf("id", "name"))
  
          // async fun
          ContactsHelper(context).getContacts {
              for (contact in it) {
                  cursor.newRow()
                          .add("id", contact.contactId)
                          .add("name", contact.firstName)
              }
          }
  
          return cursor
      }
  
  
  **in ContactsHelper class**
  
  fun getContacts(ignoredContactSources: HashSet&lt;String&gt; = HashSet(), callback: (ArrayList&lt;Contact&gt;) -&gt; Unit) {
          Thread {    
                  callback(...)            
          }.start()
      }
  </code></pre>
  
  <p>Returned cursor does not contains data, How can I add data to cursor then return it?</p>