0

For support multiscreen devices android, typically using a drawable-xhdpi, drawable-hdpi, drawable-mdpi, drawable-ldpi for resources images. For using it with assets folder how to implement it? Do I need to create separate folder like assets-hdpi, assets-mdpi? Or what?

sjarifHD
  • 3
  • 3

2 Answers2

3

Assets folder is the folder using for stored raw data/resource such as media/audio files, text file or html ... which can be used for every screen size/density. For support multi screen you only need to develop different layout/drawable file and put them into corresponding folder as you said above and don't need to make different raw data for multi screen.

ThaiPD
  • 3,503
  • 3
  • 30
  • 48
1

No. You can't create such folders. But you can name your files different names (this example is for fonts) e.g:

  font_for_large_screen.ttf   - for big screen
  font_for_small_screen.ttf - for small screen

and then have this strings in res -> values . As you may know, you can differentiate string values by screen sizes (and other characteristics). So, on on hdpi screen font value will be :

font_for_large_screen.ttf

on small :

font_for_small_screen.ttf

and you can grab appropriate font (or other file) from assets. Hope this will help you.

Misha Akopov
  • 12,241
  • 27
  • 68
  • 82
  • Is it same way for image? can I create xml file in drawable folder to linking image from assets folder? – sjarifHD May 05 '15 at 08:44
  • Why should you have image in assets ? Keep all images in drawables – Misha Akopov May 05 '15 at 08:50
  • I have 300+ images and store their filename in sqlite. To keep the small size of apk, I plan to distribute the data separately and can be downloaded. As I know android supports it and save data to the assets folder. – sjarifHD May 05 '15 at 09:24
  • Sure, you may have strings in values. But in this case it would be better to have string array: http://developer.android.com/guide/topics/resources/string-resource.html#StringArray with different file names. please mark as solution if the post helped you – Misha Akopov May 06 '15 at 16:11