读取库外的资产文件 android

Read assets file outside library android

我正在创建一个 Android 库,我希望开发人员能够在他们的 Android 项目中提供一个配置文件。

有什么方法可以在没有 android 项目上下文的情况下找到和读取这个文件(具有特定名称)?

或者库配置文件是否有标准程序?

Is there any way to find and read this file(having a specific name) without having the context of the android project?

不,假设 "the context of the android project" 是指 Context

Or is there a standard procedure for library configuration files?

通常,这将是某种形式的资源,或者可能是资产。或者什么都不做,而是使用应用程序开发人员会调用的某种构建器 API。

如果您不想处理 Context,请接受 InputStream 作为构造函数或初始化方法的参数。这使应用程序开发人员可以灵活地使用原始资源、资产、内部存储、外部存储或其他可能的位置来拥有此配置文件。