Starting from Basic4android v2.00 it is possible to embed resource files inside the library jar. During compilation the resource files will be copied to the APK file automatically.
Note that you cannot use the standard Android resources mechanism. Android SDK currently doesn't support it. This means that XML layouts cannot be added this way.
The first step is to add the resource file to the Eclipse project under the Package node (the image name is droid.png):
To access the embedded resource you should use the following code:
For example:
Note that you cannot use the standard Android resources mechanism. Android SDK currently doesn't support it. This means that XML layouts cannot be added this way.
The first step is to add the resource file to the Eclipse project under the Package node (the image name is droid.png):
To access the embedded resource you should use the following code:
B4X:
this.getClass().getResourceAsStream("droid.png")
For example:
B4X:
public Bitmap GetImage() {
BitmapWrapper bw = new BitmapWrapper();
bw.Initialize2(this.getClass().getResourceAsStream("droid.png"));
return bw.getObject();
}