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
23
votes
9 answers

How to access files from assets folder during tests execution?

How to access files from assets folder during unit tests execution? My project is build using Gradle, I use Robolectric to run tests. It seems like gradle is being recognizing the assets: This is how I'm struggling to read the file: public String…
Eugene
  • 59,186
  • 91
  • 226
  • 333
22
votes
3 answers

DB File in Assets Folder. Will it be Updated?

I'm new to the Android SQLite whole thing. This is what I have: I have db.sqlite in my assets folder. The intent of the db is to READ ONLY. The user will not write to it. When the app gets updated, the db.sqlite will be replaced be a new db (I'll…
iTurki
  • 16,292
  • 20
  • 87
  • 132
20
votes
2 answers

Image Asset versus Vector Asset

When it comes to adding an icon to my app, there're two main options: IMAGE ASSET || IMAGE VECTOR What are the differences between the Image Asset and Vector Asset? What makes them different?
Ian Gallegos
  • 524
  • 1
  • 9
  • 18
19
votes
4 answers

Save a (.txt) file to the Assets Folder in Android?

How to write to .txt file in assets folder. How to get path assets folder ?
Sardor Dushamov
  • 1,665
  • 3
  • 17
  • 44
19
votes
2 answers

How to attach pdf file from assets in email?

How do I attach pdf file from assets to email in my application? I am using following code to attach image but I don't know how to attach pdf. EMail.java file package com.drc.email; import android.app.Activity; import…
Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
18
votes
3 answers

How to get file read line by line

I have a file containing text in separate line. I want to display line first, and then if I press a button, the second line should be displayed in the TextView and the first line should disappear. Then, if I press it again, the third line should be…
Sunny
  • 14,522
  • 15
  • 84
  • 129
18
votes
2 answers

Reading file from assets directory throws FileNotFoundException

I'm trying to read in a text file of a bunch of words that I want to use for a word game I am writing. This list is stored in the assets directory and is a txt file. But, whenever I attempt to open it, it throws an exception. ListwordList =…
18
votes
1 answer

Jackson ObjectMapper with arbitrary JSON keys

I'm using Jackson 1.9.5 in an Android project to parse JSON files. So far I haven't had any problems, and can parse files fine using the following code: AssetManager mgr = getAssets(); ObjectMapper mapper = new ObjectMapper(); try { InputStream…
aaronsnoswell
  • 6,051
  • 5
  • 47
  • 69
17
votes
5 answers

Undefined reference to AAssetManager_fromJava

I am trying to access assets from an android apk using AAssetManager. However, I keep getting "Undefined reference to AAssetManager_fromJava" even though I've included asset_manager.h and asset_manager_jni.h Other functions from asset_manager.h,…
devin
  • 1,078
  • 1
  • 9
  • 23
16
votes
4 answers

Android: WebView improve loading speed of local html Files

Is there a way to improve the speed of loading an local .html file into a WebView. The .html files are stored in the /assets Folder. As you can see in the video (Sorry, link is broken!), TextView (red beackground) is rendered before the transistion…
longi
  • 11,104
  • 10
  • 55
  • 89
15
votes
6 answers

Opening a File from assets folder in android

I have a .gif file inside the assets folder like this assets/Files/android.gif. when I try to open the file it throws an exception at the second line AssetManager mngr=getAssets(); InputStream is2=mngr.open("Files/android.gif"); so Is it that I'm…
Mina Wissa
  • 10,923
  • 13
  • 90
  • 158
15
votes
2 answers

Android Webview shouldOverrideUrlLoading method

When is shouldOverrideUrlLoading method called? webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { } }); Is it called during initial loading of url? e.g.…
JR Galia
  • 17,229
  • 19
  • 92
  • 144
15
votes
3 answers

How to access files under assets folder of other apk's?

When we browse any apk we found there is one folder named assets. Now I want to access that folder programatically. so how should I proceed for that? (Input for the program will be apk file/just app name).
AndroidDev
  • 189
  • 1
  • 2
  • 7
14
votes
3 answers

how to get file path of asset folder in android

I have an Android application used to transfer the .png image from asset folder of Android application to my local server. I need to get the path of image in asset folder, pls refer my code below, String stringPath =…
sivanesan1
  • 779
  • 4
  • 20
  • 44
14
votes
4 answers

Android - Copy files from assets to /data/data folder

I need to use some files in my app. They are kept in asset folder. I saw discussions on SO, where the files are being copied from asset folder, to /data/data/ on the internal storage, and then being used. I get the code, but what I do…
superuser
  • 625
  • 3
  • 7
  • 19
1
2
3
39 40