Skip to content

Instantly share code, notes, and snippets.

@a914-gowtham
Last active September 29, 2021 06:30
Show Gist options
  • Save a914-gowtham/8353c8d4880d2a6e68f3f102e06b61c4 to your computer and use it in GitHub Desktop.
Save a914-gowtham/8353c8d4880d2a6e68f3f102e06b61c4 to your computer and use it in GitHub Desktop.
object UserUtils {
fun queryContacts() {
val listOfContact= mutableListOf<String>()
listOfContacts.add("9500552211")
listOfContacts.add("9500552212")
listOfContacts.add("9500552213")
listOfContacts.add("9500552214")
listOfContacts.add("9500552215")
listOfContacts.add("9500552216")
listOfContacts.add("9500552217")
listOfContacts.add("9500552218")
listOfContacts.add("9500552219")
listOfContacts.add("9500552210")
listOfContacts.add("9500552221")
val subLists: List<List<String>> = listOfContact.chunked(size = 10)
ContactsQuery.totalQueryCount=subLists.size
val contactQuery= ContactsQuery()
for(index in subLists.indices)
contactQuery.makeQuery(index,ArrayList(subLists[index]), onQueryListener)
}
private val onQueryListener=object : QueryListener {
override fun onCompleted(queriedList: ArrayList<UserProfile>) {
//handle the result
}
override fun onStart(position: Int, contactBatch: ArrayList<String>) {
Timber.v("onQueryStart pos: $position inputs: ${contactBatch.size}")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment