Last active
June 8, 2021 09:14
-
-
Save adesamp/f7313409bb958facb668fc76e4f79135 to your computer and use it in GitHub Desktop.
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
class MainActivity : AppCompatActivity() { | |
private lateinit var bmiBrain: BmiBrain | |
// initialize class | |
bmiBrain = BmiBrain(this) | |
// load value | |
binding.apply { | |
lifecycleScope.launch { | |
val name = async { bmiBrain.getName() } | |
edtName.setText(name.await()) | |
} | |
} | |
// save value | |
val name = edtName.text.toString() | |
lifecycleScope.launch { | |
bmiBrain.saveName(name) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment