Created
September 19, 2021 19:38
-
-
Save devDeejay/0418b7ff8fd3ae9c8ccd4c9d568a3d09 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 : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
// Calling our Refactored function | |
GreetUser("DEEJAY") | |
} | |
} | |
// To Live Preview This | |
@Composable | |
fun GreetUser(name: String) { | |
Text(text = "Hello $name!") | |
} | |
// We annotate this one with | |
// @Preview | |
@Preview | |
@Composable | |
fun PreviewGreetUser() { | |
// Calling our function | |
// which we want to Preview | |
GreetUser("Medium") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment