I am trying to support two Icon_Picker intents:
org.adw.launcher.icons.ACTION_PICK_ICON
and
com.betterandroid.launcher2.icons.PICK_ICON_ACTION
Unfortunately ADW, Go Launcher and LauncherPro look for drawables in the /drawable
either using the intent mentioned above, or by using an XML which looks in /drawable
Whereas the old BetterAndroid intent scans for images in the /assets
folder. Now, I know of the great trick for drawables in order to supply a drawable from an XML:
<?xml version="1.0" encoding="UTF-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/com_aac_cachemate_demo_cachemate" />
</selector>
Therefore instead of supplying a graphic, I point to an existing graphic - Good for not needing duplicate files when referencing the same image, but with different names/ids.
My Questions:
1) Is there any equivalent trick that would work when referencing the /assets
instead of drawable?
2) If I were to use AssetManager
to read the assets and make them drawables:
a) Would they be readable by the Intent scanning for those drawables?
b) Would the app size inevitably double in size anyway?
c) How would I implement AssetManager correctly for this to work? Something like:
sampleimage= BitmapFactory.decodeResource(context.getResources(), R.drawable.sampleimage);
maybe? Or would there be better options to getAsset()
from an Array maybe?
What I'm trying to achieve is not only have the images in /drawable
but also somehow linked to /assets
so that both intents can scan and find the drawables and display in their gridview without having to duplicate the graphics (putting them in both assets and drawable folders. Thanks for any help!
EDIT: android: how to load xml file from assets directory? was a very helpful read, but I'm not sure it completely rules out what I'm trying to achieve. Any/All input is appreciated.
So: It seems I would have to do it the other way, if it is to work at all. (The other way) meaning I need to store the graphics in the assets
folder and then use AssetManager
to get them into drawable
. Any suggestions on how to do that? Is there no way to reference the assets by using XML in the drawable
folder?
Therefore the questions that really matter to me, If I were to use AssetManager
to read the assets and make them drawables:
1) Would they be readable by the Intent scanning for those drawables?
2) Would the app size inevitably double in size anyway?