In AndroidManifest.xml, we need to declare our Activity and we can provide a label, i.e.
<activity android:name="MyActivityClass"
android:label="Activity Label" />
In Jetpack Compose, how can I get that Activity Label?
I tried to get from LocalContext.current
but can't find it.
@Composable
fun TopBar() {
val context = LocalContext.current
val title = context.getActivity().getTitle() // Wrong API... not there
TopAppBar(
title = { Text(text = title, fontSize = 18.sp) },
backgroundColor = MaterialTheme.colors.primary,
contentColor = Color.White
)
}