Files
AndroidJetpack/Jetpack-Compose-Playground/docs/cookbook/get_android_context.md
T
2026-07-15 16:57:36 +08:00

437 B

You can use LocalContext.current to receive the context of your Android App inside a Compose Function

@Composable
fun AndroidContextComposeDemo() {
    val context = LocalContext.current
    Text(text = "Read this string from Context: "+context.getString(R.string.app_name))
}

See also:

  • [Full Example Code]({{ site.samplefolder }}/other/AndroidContextComposeDemo.kt)