Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ウェブサーバーを使用してファイルを提供したいので、アプリのアセットフォルダーの絶対パスを取得する必要があり、絶対パスが必要です。これは可能ですか?
私は次のようなものがあるかもしれないと思っていたでしょう:
String rootDir = getAssets().getRootDirectory();
しかし、ありません。
どんな助けでも感謝します、乾杯。
これは可能ですか?
いいえ。「[your] アプリのアセット フォルダーの絶対パス」はありません。アセットは APK ファイルに保存されます。
に提供される URL などの特定のケースではWebView、特別なfile:///android_assetベース URL を使用して、アセット内のファイルを参照できます。
WebView
file:///android_asset
APK の assets ディレクトリからデバイスのフォルダーにファイルをいつでもコピーして、そのフォルダーを提供できます。