What I finally did (until now, I could only verify on an iOS and Droid project, Windows Phone is still in the works):
I return the image data from my shared project as Stream
, as in:
public Stream GetImageStream () {
return assembly.GetManifestResourceStream (nameOfResource);
}
Images' properties are set to EmbeddedResource
. In my iOS project, I can then access my image like so:
using (var stream = myClass.GetImageStream ()) {
var image = new UIImage (NSData.FromStream (stream));
// do stuff with image
}
And on Android I use the following code:
using (var stream = myClass.GetImageStream ()) {
var bitmap = BitmapFactory.DecodeStream (stream);
// do stuff with bitmap
}
Feedback whether there any gotchas with this practice are welcome! (beside the obvious sizing-issue, which I can live with for now, I could imagine that this approach circumvents any platform-specific caching mechanisms?)