Where to put drawable resources for an OpenFL andr

2019-05-10 03:34发布

问题:

I am making an android extension for my OpenFL app, which is supposed to show a notification, when I call a function from Haxe.

I need to put a drawable icon in my extension project, because a notification requires an icon.

However, the Java file extends an "Extension" class, which provides the object - Extension.assetManager (android.content.res.AssetManager)

How do I use this to access a drawable similar to R.drawable....?

And also where to put drawable resources for the OpenFL android extension?

回答1:

It looks like AssetManager can access files in the "assets" folder, so I suspect what you need to do is create this folder in the root of the extension project. To open the file, you'd use something like this:

Bitmap bitmap = BitmapFactory.decodeStream(AssetManager.open("filename.png"));