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
8
votes
1 answer

New Image Asset Launcher Icon Loss of Transparency

I am trying to add a launcher icon for an app in Android Studio. What I've done so far: Gone to res folder right click and select new image asset From there I find the png file which I would like to use as the app launcher icon. This step is seen…
sawreals
  • 338
  • 4
  • 15
8
votes
2 answers

fopen in JNI C code get failed for file placed in assets folder in android application

I have kept some files in assets folder of android application. Now i compile that application and get apk. [when i extract that apk my files are there in assets folder] Now i install that apk in mobile device and in That application has some code…
Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222
8
votes
5 answers

Read xml file from Android Asset folder

I'm trying to read the same file "xmlfile.xml" from the assets folder and also another copy from the SD card sdcard/download/. I can Read from SD Card: unfile Return True Esite Return True I can't not Read from Assets folder: unfile Return…
marcoqf73
  • 1,306
  • 3
  • 14
  • 18
7
votes
3 answers

openRawResourceFd fails on android

I'm writing my first Android application, and I'm trying to read a res/raw resource file. The following code throws a FileNotFound Exception: AssetFileDescriptor fd = res.openRawResourceFd(R.raw.myfile); but this line of code works: InputStream…
WOPR
  • 319
  • 2
  • 6
  • 14
7
votes
1 answer

How to test and deploy a Flutter app with more than 150 MB of assets?

The assets in my Flutter app are about 300 MB in total (lots of media files, which are the essence of the app and can't sensibly be trimmed down). As I understand it, there are two ways to upload apps to the Play Store: An APK file (legacy)…
Thomas
  • 174,939
  • 50
  • 355
  • 478
7
votes
5 answers

Android: copy database from asset folder, but only get an empty file

guys, I have the problem when copying database from local assets folder to /data/data/package_name/databases directory. As I use the http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ tutorial to do it, I can…
4af2e9eb6
  • 682
  • 3
  • 7
  • 20
7
votes
3 answers

Use of file:///android_res/drawable/ url works under eclipse but not in production

I have a problem that is driving me nuts. I have a static html file (assets/help/index.html) that needs to include some images. As I want different images for different densities and the images are already included in drawable-{ldpi,mdpi,hdpi} I…
Pieter
  • 221
  • 2
  • 10
7
votes
2 answers

MVVM in android,accessing assetManager without breaking the pattern

I have a JSON file in the assets folder and DataManager(repository) class needs it so assetManager(and context) should have access to the assets. The problem is that based on Best practice, Android context or android specific code should not be…
Hessam-Emami
  • 347
  • 2
  • 4
  • 15
7
votes
3 answers

BitmapFactory.decodeStream from Assets returns null on Android 7

How to decode bitmaps from Asset directory in Android 7? My App is running well on Android versions up to Marshmallow. With Android 7 it fails to load images from the Asset directory. My Code: private Bitmap getImage(String imagename) { //…
Savari
  • 73
  • 1
  • 1
  • 6
7
votes
4 answers

Assets Folder Not Getting Added To Android Studio Project and APK

I'm trying to add an Assets folder to my Android Project in Android Studio 2.1.2. I right click on the project and choose New -> Folder -> Assets Folder. In the project pane on the left, it doesn't show up when Android is selected. If I switch to…
Nullqwerty
  • 1,140
  • 1
  • 20
  • 37
7
votes
1 answer

Problem while opening Asset File with the help of Content Provider

My requirement is to open one app's Asset file from another app via content provider.(I am exposing that file with ContentProvider implementation) I am able to open few files and read, but while opening some files I am getting exception. Please find…
Andhravaala
  • 319
  • 6
  • 18
7
votes
1 answer

Android Home As Up Indicator filename or location

Where do I find the Android "Up" button drawable so that I can customize it? Or what is its filename, so that I can do a quick search to locate it within a sdk directory?
7
votes
5 answers

Android external database in assets folder

I have an android application that is supposed to read and expand a database that is already created on sqlite...it works fine on emulator by putting database in "data/data/(packagename)/database" folder on the file explorer of emulator. Now problem…
Anas Shahid
  • 353
  • 2
  • 5
  • 10
7
votes
5 answers

Circular progressbar

I want to create a circular progressbar, like in this image below I don't know what the method that creates this progressbar is. And I don't know what assets should be prepared.
6
votes
3 answers

How to use preloaded SQLite database in Android from Assets

I want to use preloaded database in my app means trying to get database at the time the apk is installed so can use the data already saved in that. I copy the "ingredients.db" file in the assets folder. And Use the following code but this get the…
MKJParekh
  • 34,073
  • 11
  • 87
  • 98