Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 62
Registered: ‎10-29-2008
My Device: 9800
My Carrier: Rogers

Problem with imageSource coming from appdata directory on dev alpha c

I am working on testing my apps on the Dev Alpha C to ensure that we're ready for the launch of the Q10, however I am hitting a wall.
 
One of the things that we do is load image assets from the application's data directory (we manually create these images upon app launch).
 
On my current z10 this works perfectly, however on the dev alpha c running the latest OTA OS, I get the following error:
 
(2) "Unable to get asset: (/accounts/1000/appdata/me.volu.Lights.testDev_volu_Lights441de853/data/refresh.png)." 
(2) Image not found:  "/accounts/1000/appdata/me.volu.Lights.testDev_volu_Lights441de853/data/refresh.png" 
 
In QML I am including it as follows:
 

        ImageView {

        id: refreshImage

        imageSource: Qt.styles.refreshBtnURL  

        verticalAlignment: VerticalAlignment.Center

        horizontalAlignment: HorizontalAlignment.Center

        preferredHeight: 75.0

        preferredWidth: 75.0

        opacity: refreshStatusContainer.opacity;

    }

 

I am returning the path to QML as follows:

 

const QDir home = QDir::home();

return home.absoluteFilePath("refresh.png");

 

Any ideas?

 

Thanks!

 

 

Any ideas?

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Problem with imageSource coming from appdata directory on dev alpha c

I tested on my Z10 running OS 10.1.0.1248 and was able to reference the image in the /data directory using it's absolute path:

ImageView {
imageSource: "/accounts/1000/appdata/com.example.HelloCascades.testDev_lloCascades1bc498e0/myPic.png"
}

 

So this could be a bug with the particular OS on your device. Could you try hard-coding the path in the imageSource property as a quick test. If this doesn't work, I don't expect it will, please pass me the OS version you are using. I will test in a Dev Alpha C and then verify it's fixed in a later OS.

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Problem with imageSource coming from appdata directory on dev alpha c


gbeukeboom wrote:

I tested on my Z10 running OS 10.1.0.1248


I would also like to test it, where do i get the OS? Smiley Wink

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Problem with imageSource coming from appdata directory on dev alpha c

This particular OS is internal only right now. More external updates will be coming out in time

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 62
Registered: ‎10-29-2008
My Device: 9800
My Carrier: Rogers

Re: Problem with imageSource coming from appdata directory on dev alpha c

Dev Alpha C

OS: 10.1.0.138

It seems as though that when I specify the path manually as

/accounts/1000/appdata/me.volu.Lights.testDev_volu_Lights441de853/data/refresh.png

 

it does not work. Same error.

 

When I specify:

file:///accounts/1000/appdata/me.volu.Lights.testDev_volu_Lights441de853/data/refresh.png

 

it does work

 

Z10

Setting the path as

/accounts/1000/appdata/me.volu.Lights.testDev_volu_Lights441de853/data/refresh.png

does work

 

Setting the path as

file:///accounts/1000/appdata/me.volu.Lights.testDev_volu_Lights441de853/data/refresh.png

does work

 

Seems as though my solution should be to prepend the value that my QDir.absoluteFilePath with "file://" for the short term, however will this cause problems going forward?

 

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Problem with imageSource coming from appdata directory on dev alpha c

10.1.0.1020 was released a couple weeks ago, could you give it a try to see if it's fixed there?

https://developer.blackberry.com/blackberry10devalphas/update/

 

Prepending with file:// shouldn't cause issues, but image loading "should" work without it and this does appear to be fixed already so should work when the Q10 launches.

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 62
Registered: ‎10-29-2008
My Device: 9800
My Carrier: Rogers

Re: Problem with imageSource coming from appdata directory on dev alpha c

I am now running version 10.1.0.1022 and have the exact same issues

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Problem with imageSource coming from appdata directory on dev alpha c

I ran a few tests on 2 OS builds for the Dev Alpha C and in both cases I could load the OS from the /data directory without issue.

 

Here's what I did:

1) Deployed a skeleton sample app with the following reference in it:

ImageView {
imageSource: ""
}

2) Used the IDE File Explorer to drop in an image file to the app's /data directory

3) Update the imageSource reference to the file I just added

4) Re-deploy

 

Can you verify this works as expected on your device? It may also be good to check the image files you are downloading to verify the open as expected in your computer's OS.

Garett
@garettBeuk
--
Goodbye everybody!
Developer
Posts: 62
Registered: ‎10-29-2008
My Device: 9800
My Carrier: Rogers

Re: Problem with imageSource coming from appdata directory on dev alpha c

I tried the above and I'm having the same issue.

 

The only way that I can get these images to show up is to prepend the path with "file://"

Retired
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: Problem with imageSource coming from appdata directory on dev alpha c

Now we have to find the delta between our testing. We had the same OS, device and testing steps, could you provide an image file you used to repro the issue?

Garett
@garettBeuk
--
Goodbye everybody!