Accessing Resources without a Context

后端 未结 5 1709
小鲜肉
小鲜肉 2020-12-03 04:31

I\'m trying to put configuration, such as URLs/etc, into a resource folder for a utility class to use. However, I don\'t want to pass the Context from the activities everywh

5条回答
  •  有刺的猬
    2020-12-03 05:18

    The stackoverflow answer to the question below shows how to use POJO to obtain a stream to a resource, if you supply its path. This might be useful in cases you need to select a specific resource from one of many.

    Is it possible to read a raw text file without Context reference in an Android library project

提交回复
热议问题