0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Querying resource properties using LocalContext.current

0
Posted at

androidx.compose:compose-bom を 2025.11.01 -> 2025.12.00 にアップデートしたところ、
lintでエラーが出るようになりました。

 Error: Querying resource values using LocalContext.current [LocalContextGetResourceValueCall from androidx.compose.ui]

対処

LocalResourcesを代わりに使うことで解消できます。

- val context = LocalContext.current
+ val resources = LocalResources.current
LaunchedEffect(Unit) {
-  val foo = context.getString(R.string.bar)
+  val foo = resources.getString(R.string.bar)
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?