Questions tagged [assets]

1. Non-code files packed with an application (example, data or media files). 2. From a security point of view - any data or resource that should be (or can be) protected.

3549 questions
355
votes
13 answers

Using fonts with Rails asset pipeline

I have some fonts being configured in my Scss file like so: @font-face { font-family: 'Icomoon'; src: asset-url('icoMoon.eot?#iefix', font) format('embedded-opentype'), asset-url('icoMoon.woff', font) format('woff'), …
rctneil
  • 7,016
  • 10
  • 40
  • 83
268
votes
23 answers

How to copy files from 'assets' folder to sdcard?

I have a few files in the assets folder. I need to copy all of them to a folder say /sdcard/folder. I want to do this from within a thread. How do I do it?
Rohith Nandakumar
  • 11,367
  • 11
  • 50
  • 60
216
votes
51 answers

FlutterError: Unable to load asset

This is the folder structure of my app .idea .vscode android build fonts Oxygen-Bold.tff Oxygen-Light.tff Oxygen-Regular.tff images pizza0.png pizza1.png ios lib ui home.dart …
Matthias
  • 12,704
  • 13
  • 35
  • 56
159
votes
13 answers

How to get URI from an asset File?

I have been trying to get the URI path for an asset file. uri = Uri.fromFile(new File("//assets/mydemo.txt")); When I check if the file exists I see that file doesn't exist File f = new File(filepath); if (f.exists() == true) { Log.e(TAG,…
Titus
  • 1,613
  • 2
  • 11
  • 8
142
votes
6 answers

Play audio file from the assets directory

I have the following code: AssetFileDescriptor afd = getAssets().openFd("AudioFile.mp3"); player = new MediaPlayer(); player.setDataSource(afd.getFileDescriptor()); player.prepare(); player.start(); The problem is that, when I run this code, it…
Catalin Morosan
  • 7,897
  • 11
  • 53
  • 73
107
votes
14 answers

How to find unused images in an Xcode project?

Has anyone a one-line to find unused images in an Xcode project? (Assuming all the files are referenced by name in code or the project files - no code generated file names.) These files tend to build up over the life of a project and it can be hard…
elasticrat
  • 7,060
  • 5
  • 36
  • 36
100
votes
4 answers

Access Asset Catalog programmatically

I know it's a new feature and this may not be possible, but I would love to be able to use an Asset Catalog to organize my assets, but I access all of my images programmatically. How would I access my images, now? Do I still access them by their…
RileyE
  • 10,874
  • 13
  • 63
  • 106
92
votes
5 answers

Is there a way to alias/anchor an array in YAML?

I'm using Jammit to package assets up for a Rails application and I have a few asset files that I'd like to be included in each of a few groups. For example, I'd like Sammy and its plugins to be in both my mobile and screen JS packages. I've tried…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
86
votes
3 answers

How to load specific image from assets with Swift

I'm new to Swift and I want to load a special image from assets. For example I have: image 1 for iphone 4s = green-square@2x.png image 2 for iphone 5/5s = green-square-Retina@2x.png image 3 for iphone 6s = green-square@3x.png and I want to load for…
Ghost
  • 903
  • 1
  • 6
  • 7
76
votes
6 answers

Rails 3.1 asset pipeline: how to load controller-specific scripts?

If I generate a new controller in Rails 3.1, also a javascript file with the name of the controller will added automatically. Firstly, I thought this javascript file will used only, when the related controller is called. By default there is the…
Mike Bevz
  • 1,266
  • 1
  • 14
  • 20
73
votes
4 answers

Check if a file exists before loading it

What I want to do is load an image in a Material Widget to use it in a ListTile, but this asset might not exist. class MyImage extends StatelessWidget { final imagePath; MyIcon(String iconName) { try { // check if imagePath exists. Here is…
Isaac
  • 1,436
  • 2
  • 15
  • 29
72
votes
13 answers

How to play videos in android from assets folder or raw folder?

I am trying to play a video in android emulator I have the video in my assets folder as well as the raw folder But after doing some research still i cant play video in my emulator i am working on android 2.1 My video format is mp4 so i don't think…
Abhishek Talwar
  • 729
  • 1
  • 6
  • 3
69
votes
9 answers

Load an image from assets folder

I am trying to load an image from the asset folder and then set it to an ImageView. I know it's much better if I use the R.id.* for this, but the premise is I don't know the id of the image. Basically, I'm trying to dynamically load the image via…
kishidp
  • 1,918
  • 6
  • 23
  • 29
66
votes
4 answers

How to get the android Path string to a file on Assets folder?

I need to know the string path to a file on assets folder, because I'm using a map API that needs to receive a string path, and my maps must be stored on assets folder This is the code i'm trying: MapView mapView = new MapView(this); …
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
65
votes
3 answers

Include assets when building angular library

I am building a library which contains a custom icon font. However, when I build my library using ng build --prod, the assets folder is not included in the build, which means icons do not show up when using the production build. I've…
1
2 3
99 100