MobileMobile | Continue
       
Nibiru VR Development Nibiru Studio Image from URL not working !!!!!

Image from URL not working !!!!!

Rajay Post time 2017-9-28 12:00 | Show all posts [Copy URL]
3 832
URL url = null;
                try {
                        url = new URL("https://www.blob.core.windows.net/268bf6de28a23d727ac7141c675ca714/8a19b431-2eb9-4922-a6c6-1c79fc88dfb5.png");
                        Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());

                        toolbar = new XImage(url.toString());
                        toolbar.setCenterPosition(0.5f, 3.0f, -6.0f);
                        toolbar.setSize(7.5f, 1.0f);
                        toolbar.setRenderOrder(7);
                        addActor(toolbar);

                } catch (IOException e) {
                        e.printStackTrace();
                }
Reply

Use magic Report

Post time 2017-7-26 16:19 | Show all posts
Edited by StevenZhang at 2017-7-26 17:12 \n\nHi,

Nibiru Studio only accepts texture name or assets file name as the parameter of UI components.
So you get Bitmap first, then call the followings code:

                createBitmapTexture(bmp, "XXXX", new IXBitmapTextureCreateSuccessListener() {
                        public void onCreateSuccess(String texName, boolean isSuccess) {

                        }
                });

This method is used to generate a texture from the Bitmap. You can give a name to identify the texture ("XXXX" for example). The callback listener is set to listen the generate result. After generate successfully, you can use the texture name to Image or other UI components.

For example:

                        toolbar = new XImage("XXXX");
                        toolbar.setCenterPosition(0.5f, 3.0f, -6.0f);
                        toolbar.setSize(7.5f, 1.0f);
                        toolbar.setRenderOrder(7);
                        addActor(toolbar);

It is better to read our Development Guide before starting develop. You can download the document in our website (Downloads). The bitmap usage you can refer on Page 16 (ver 1.3.0).

Steven
Post time 2017-8-8 17:36 | Show all posts
StevenZhang replied at 2017-7-26 16:19
Edited by StevenZhang at 2017-7-26 17:12 \n\nHi,

Nibiru Studio only accepts texture name or asset ...

HI Steven,

               I have tired with createTextureBitmap() functions as you suggested . It solved my problem.
Thanks !!! Steven !!!
Post time 2017-9-28 12:00 | Show all posts
I'm not sure if this is the error you are experiencing, but when I try loading the URL to the PNG asset, you listed in your original post, I only see an error.
Could it be that the resource you are trying to load requires some sort of authentication?
Can you load any remote asset?
Can you try loading
and report if that loads as expected?
You have to log in before you can reply Login | Register

Points Rules

!fastreply! Top !return_list!