【问题标题】:Where is the getResources() method implemented?getResources() 方法在哪里实现?
【发布时间】:2014-05-29 21:40:20
【问题描述】:

有人知道getResources() 方法在哪里实现吗?它是android.content.Context 类中的抽象方法,但我找不到哪个类实现了它?我在 SO 上找到了 answer,但它似乎不是正确的答案。

我正在搜索一个实现getResources() 方法的特定类,因为我想知道它到底做了什么。

我在哪里可以找到“某些东西”的实现,而不仅仅是调用其他东西?

【问题讨论】:

标签: android


【解决方案1】:

ContextImpl 是规范的Context 实现类。它有很多方法来初始化其mResources 成员变量,然后可以使用getResources() 访问。

Contexts 遵循通常的Activity - ContextThemeWrapper - ContextWrapper 继承路径delegate getResources() to the base contextbase context is set up as ContextImpl instance when the activity is created

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-08
    • 1970-01-01
    • 2011-11-03
    • 2012-03-05
    • 2019-11-30
    • 2021-04-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多