reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
216 stars 327 forks source link

Android 原生模块如何读取 assets 目录文件? #641

Closed weishengkui closed 1 year ago

weishengkui commented 1 year ago

我需要在 Android 原生模块 读取 assets 目录下的文件。 但是从 ReactApplicationContext 获取不到 Android 的 assets 目录。不知道应该如何操作? 以下是代码:

public class Predictor extends ReactContextBaseJavaModule {
    private ReactApplicationContext mContext;
    public Predictor(ReactApplicationContext reactContext) {
        super(reactContext);
        mContext = reactContext;
      // 这个只能获取react-native 级别的目录, 不知道如何获取Android 的 assets
        String ss = mContext.getCacheDir().toString();

    }
github-actions[bot] commented 1 year ago

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.