Resources.getSystem()知らんかった

私、Android開発に7年くらい携わっているんですが、さっきResources.getSystem()というのでContextが取得できるのを知りました。 Android開発やってるとContextの取り回しに苦労する事が多いので、楽が出来るのかもなと思いました。

リファレンスによると

Return a global shared Resources object that provides access to only system resources (no application resources), and is not configured for the current screen (can not use dimension units, does not change based on orientation, etc).

https://developer.android.com/reference/android/content/res/Resources.html#getSystem()

と説明されているのでandroid.Rで参照できるリソースはOKだけど、アプリ内で定義したリソースは取得できない他、いろいろ出来ることも限られているということかな。 まぁ、覚えとくとそのうち役に立つかもなー。