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
2 answers

Android : ArrayList with Bitmap from assets

I've been trying to do a list out of an images from the assets directory, and this is my code ArrayList list = new ArrayList<>(); try{ String[] PathFiles = assetManager.list("img"); for (int i = 0; i < PathFiles.length;…
0
votes
0 answers

Android:How to Copy a Folder From 'assets' Includes files and folders to sdcard

I want copy a folder to 'sdcard' with all files and folders. How do I put all the files in the exact path?(foler1/file1.txt,...file4.txt),(foler2/file1.txt,...file4.txt),... by this following code I can to copy files to sdcard that exists in…
0
votes
1 answer

App Crash due to start of activity that launches asset activity

I am in the learning stage and i am building an app to test system activities. Here's the code for the main activity: public class MainActivity extends ListActivity { String tests[] = { "LifeCycleTest", "SingleTouchTest", "MultiTouchTest", …
Kavach Chandra
  • 770
  • 1
  • 10
  • 25
0
votes
2 answers

How to speed up Android app loading 140,000-item ArrayList from an Asset

I have a Java program that I just turned into a slooooooow-to-load Android app. The problem: it deals with a 140,000-word "dictionary" (stored in an Asset file) in which to look for words matching "Windows wildcard" patterns: E.g., S???CK* would…
DSlomer64
  • 4,234
  • 4
  • 53
  • 88
0
votes
0 answers

How can I read a file constantly with AssetManager in Android Studio

I working on a project. In order to take different inputs from a file, I need to read my file again and again (constantly). After my code reading the file once, while it running, I change it content but it can not see the new content. My code is…
0
votes
0 answers

PDFRenderer showing wrong PDF

I'm having problems with PDFRenderer not changing the PDF it shows after the first run of the application, no matter what I do. I'm using the code from the official PDFRenderer Sample from…
Gerto
  • 26
  • 2
0
votes
1 answer

What location is most appropriate to download update to Asset file?

Sorry for the noob question. I am still pretty new to Android development. I am currently working on an Android app that was designed to pull some images from a zip file sitting in the Assets directory. The original goal, it seems, was to have the…
user1548103
  • 869
  • 2
  • 12
  • 25
0
votes
2 answers

How to get folders' name listed in Assets folder? Only folders' names but not any file names

Scenario: My Assets directory - Assets/folder1; Assets/folder2; and so on. With files in folder1 and other folders, such as Asssets/folder1/file1, and others, Asssets/folder/somefile1, and others. I want the code to access names of only folder names…
Johnny
  • 282
  • 1
  • 15
0
votes
1 answer

NDK AAsset_read(): Recommended buffer size?

Just wondering what's optimal here, as no suggestions are made in the NDK docs. I'm fairly sure that although bufSize is of type size_t, specifying SIZE_MAX might not be a wise choice!
Engineer
  • 8,529
  • 7
  • 65
  • 105
0
votes
1 answer

Copying file from asset folder to sdcard doesn't seem to work

I am trying to copy an image from the asset folder to the sdcard but doesn't seem to copy it on first launch. It creates the folder okay but doesn't copy the file over. prefs = getPreferences(Context.MODE_PRIVATE); if…
Allrounder
  • 685
  • 2
  • 9
  • 20
0
votes
1 answer

Can I use variables in assetManager.open() parametre?

I'm trying to give the open function in assetManager, which is an instance from the AssetManager class, variable like this: String filename="\"file.xml\""; AssetManager assetManager = getAssets(); InputStream inputStream = null; try…
Elia Kallas
  • 45
  • 2
  • 8
0
votes
2 answers

Copying file from subfolder in asset folder

Am trying to copy a file from a named subfolder in asset folder but am getting a "not found error" when trying to use the file. Apparently it seems am not copying the file right. Here is what I have done maybe someone can spot my error Method…
CodeZero
  • 179
  • 2
  • 15
0
votes
3 answers

Android - How do I create the assets folder manually?

I'm new to Android development, and I'm trying to manage projects from the command line using the SDK since I cannot get Android Studio 1.2 to work properly in my system (it's unresponsive). The problem: I created a new project but the asset folder…
user5078748
0
votes
1 answer

Android SqliteAssetHelper copy user saved data

I am using SQLiteAssetHelper utility to manage the copying of the database from my asset folder. In the app, the user enters some data into the database and as soon as I upgrade the db, all the data gets deleted cause I have set setForcedUpgrade();.…
qwertz
  • 6,206
  • 9
  • 40
  • 62
0
votes
0 answers

Why i am getting a NoClassDefFoundError:javax.imageio.ImageIO when trying to get an InputStream from assestManager

I have a gfx folder inside assets folder of my Android project, which contains a .png file. When I was trying to get InputStream from assetManager, I got NoClassDefFoundError. The part where I got error is: private void processImage(){ try { …