Created
January 2, 2021 04:26
-
-
Save RageshAntony/f2f9006df7bcae8974696ee6b8c6e622 to your computer and use it in GitHub Desktop.
sample code of courotine call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val scope = CoroutineScope(Job() + Dispatchers.Main) | |
// #1 | |
scope.launch { | |
withContext(Dispatchers.IO) { | |
viewModel.delBill() | |
} | |
} | |
// #2 | |
runBlocking { | |
withContext(Dispatchers.IO) { | |
viewModel.delBill() | |
}} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun delBill() { // suspend is redundant warning | |
var queryProc = "" | |
delXML.forEach { | |
queryProc += it.value | |
//Log.d(this.javaClass.simpleName, "delBill: ${queryProc}") | |
} | |
queryProc = "<NewDataSet>$queryProc</NewDataSet>" | |
Log.d(this.javaClass.simpleName, "delBill: ${queryProc}") | |
con?.deleteBills(queryProc,bills,result,date,page) // java file function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment