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.

3236 questions
350
votes
12 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
  • 6,387
  • 8
  • 33
  • 69
259
votes
22 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,037
  • 10
  • 48
  • 58
138
votes
11 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,403
  • 2
  • 10
  • 8
131
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,693
  • 11
  • 51
  • 73
98
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…
Paul Robinson
  • 6,790
  • 3
  • 33
  • 36
97
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,308
  • 12
  • 60
  • 103
87
votes
32 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
  • 9,956
  • 12
  • 31
  • 55
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,268
  • 1
  • 14
  • 20
70
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
  • 709
  • 1
  • 6
  • 3
70
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
  • 743
  • 1
  • 5
  • 7
63
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
  • 32,153
  • 66
  • 194
  • 346
61
votes
8 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,746
  • 5
  • 22
  • 27
60
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
  • 60,042
  • 58
  • 173
  • 260
59
votes
9 answers

Symfony2 - Assetic - load images in CSS

I have a CoreBundle that contains main css files and images. Now I have a problem when I load an image from css; the image isn't shown. background-image:url(../images/file.png) (with a full path it works) I installed the assets using the command:…
LBridge
  • 2,045
  • 5
  • 21
  • 30
58
votes
7 answers

How to make an iOS asset bundle?

I saw a custom asset bundle in an iOS project I evaluated, so at least I know it's possible. My issue is that I'm using a CATiledLayer with about 22,000 tiles for a given image and it takes a very long time to compile (half an hour clean build, 5-10…
michael
  • 2,272
  • 2
  • 20
  • 24
1
2 3
99 100