Questions tagged [android-assets]

You can use the `assets` folder to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the the AssetManager. For example, this is a good location for textures and game data.

In Android, you can use assets folder to store raw asset files. Files that you save here are compiled into an .apk file as-is, and the original filename is preserved. You can navigate this directory in the same way as a typical file system using URIs and read files as a stream of bytes using the AssetManager. For example, this is a good location for textures and game data.

598 questions
0
votes
1 answer

Android Failed to Show PDF using AssetManager

I want to open a PDF from the assets folder from my activity button action and I used the below codes but nothing happens. public class AssetsProvider extends ContentProvider { @Override public AssetFileDescriptor openAssetFile(Uri uri,…
0
votes
1 answer

File Access problem from asset pack in android from the testing app downloaded from Playstore?

I have a question about the file accessing process from the asset folder of android which uses play asset delivery. I have done setup with the play asset delivery for deploying my android application as the size of the app is more than 150Mb. I…
0
votes
2 answers

How do I get the absolute path of "assets" directory in Android?

I just want the path of the assets directory which I want to use as a variable throughout my app. I know we can refer a file in the "assets" directory using AssetManager, but I don't want to refer a file as of now, I just want the path of the…
Mahendra Liya
  • 12,912
  • 14
  • 88
  • 114
0
votes
1 answer

How to specify path to read a .txt file in assets directory

I want to get details about a selected harbour,by taking val s from a list extracted using readLines from a .txt file, where each harbour has a .txt file in the assets directory. I generate the file name but when the app is run in the emulator I get…
JJCNSNR
  • 9
  • 3
0
votes
0 answers

Android - play video saved from raw assets to local storage using implicit intent failing

I have a file in my raw assets directory which I am trying to save to shared phone storage that will allow other apps to open and view this video. Basic code to copy file from assets to local storage and generate intent Intent in = new…
CybeX
  • 2,060
  • 3
  • 48
  • 115
0
votes
1 answer

Android FileNotFoundException with getAssets

So the intention is simple, I want to copy the files from the APK's assets folder to the device storage. I achieved that with the below code and it was actually working, public void copyAssets() { AssetManager assetManager = getAssets(); …
Nithis Kumar
  • 278
  • 2
  • 5
  • 21
0
votes
1 answer

I need the right String to put in the brackets in "new FileReader("stringpath")"

This is a function of my Android Studio Project. I need the right String to put in the brackets in "new FileReader("stringpath")" everything I tried doesn't work. That's my code: private ArrayList generiereSpieler(int anzahl){ …
0
votes
2 answers

Problem supporting multiple resolutions on Android

I'm having a weird problem. I have been testing my app with hdpi resources up until recently. My designer sent over some mdpi assets and now my application is defaulting to the mdpi assets. How can I make sure the hdpi assets are being used for my…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
0
votes
0 answers

Can I play sound from assets without Context in Android?

For assets need to use getAssets() method, but this method requires the Context. I found some interest method getResourceAsStream(). Using: private InputStream openFile(String filename) throws IOException { return…
Dyno Cris
  • 1,823
  • 1
  • 11
  • 20
0
votes
1 answer

how to reduce android app size that is using pdf files in assets folder

I am making a book app with pdf files in the assets folder. All files are 10-20mb after compressing. How can I keep the size of the app small? It's 500+mb currently.
R kumar
  • 1
  • 2
0
votes
1 answer

android, when read the file from res/raw, context.getAssets().open(fileName), the content read in are corrupted

on Android, using com.google.gson:gson:2.8.5, when passing a josnString and when the json is large (noticed for example when string length is 669304), it got com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException:…
lannyf
  • 9,865
  • 12
  • 70
  • 152
0
votes
1 answer

Difference between res/ and resources/

Is there a difference between res/ and resources/.?? If I simply create a new directory and title it resources, it is not displayed as a normal directory, seems like resources is a keyword unlike temp which shows as a normal directory. We commonly…
0
votes
0 answers

How to get file path of files located in resources

I am using WebView and applying some styling to WebView's text. My fonts are located in the res/font folder right now and I am using those fonts to apply custom font. I creating my own html and applying font like this: …
Azizjon Kholmatov
  • 1,136
  • 1
  • 13
  • 26
0
votes
0 answers

Message: Uncaught TypeError: Cannot read property 'call' of undefined

I am using PhoneGap for a mobile app. The software is Alpha Anywhere, if that matters. Here is the error message: Message: Uncaught TypeError: Cannot read property 'call' of undefined Source file:///android_asset/www/javascript/a5.js Line::…
0
votes
2 answers

How to access images from asset in drawable xml

Since it is not possible to create sub folders in a Drawable folder, I want to move the images to an asset folder, and divide the images into different folders. My question, how do I access the image in the asset folder from the XML in the Drawable…
Michael
  • 429
  • 5
  • 22