Load NiftyImage from InputStream

Is it possible to load from InputStream?

It is possible to extend the asset loader system which uses input streams. This way you could give paths and names that don’t even exist as files.

What format is the stream in? Uncompressed RGB? JPEG?

You can use AWTLoader to load a jME3 Image from an InputStream

Actually I have Android contact’s badge. Which loaded from contact DB. I need show it to user on the screen. I use XML to build a form and NiftyImage to show a contact’s badge (maybe it is wrong way?).



I use next code to get badge on Android part:

[java]public InputStream getContactBadge(int id) {

Uri uri = ContentUris.withAppendedId(Contacts.CONTENT_URI, id);

InputStream input = Contacts.openContactPhotoInputStream(getContentResolver(), uri);

if (input == null) {

return null;

}

return input;

}[/java]



And I use next code to load image from file:

[java]NiftyImage img = nifty.getRenderEngine().createImage(“path to image on the disk”, false);[/java]



How can I get load it on the form?

I find temporary solution. You can try: http://hub.jmonkeyengine.org/groups/android/forum/topic/how-to-load-a-texture-from-android-mediastore/