If I have a separate file with my compose code, is...
# compose
b
If I have a separate file with my compose code, is there a way to access the android R.xxx.whatever ids?
R
seems to be available, but it doesn't recognize
.string
or
.drawable
outside of an Activity class.
😶 3
I've also tried using
android.R
which makes
.string
and
.drawable
accessible, but I can't access any of my custom properties defined in the xml, like I could when inside an AppCompatActivity
s
If you're trying to access stuff from your res directory, you need to import the R appropriate R package like:
import com.example.R
Inside composable functions you can use the function
stringResource
to get the string for a resource. You can find more information here: https://developer.android.com/jetpack/compose/resources
b
Awesome. Thank you @Sean Proctor!