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: 541
Registered: ‎05-17-2009
My Device: Not Specified
Accepted Solution

Resource file path

I'm working through HelloWorldDisplayManaged to display my own background. I import my file into the same folder as "HelloWorld_smaller_bubble.png". When I change the file name from "HelloWorld_smaller_bubble.png" to my file name, I would expect my image to display as a background as the tutorial did. Instead fopen generates "No such file or directory" and no image is displayed.

 

I've tried a multitude of paths for the file but nothing works. I'm not sure what I missed. Any suggestions?

 

Thanks,

Scott

Highlighted
Retired
Posts: 3
Registered: ‎10-25-2010
My Device: Not Specified

Re: Resource file path

What you are most likely missing is adding the new image as an asset in your bar-descriptor.xml. If you do not do this, the image won't be packaged in the BAR file resulting in a no such file error.

 

To add an asset to be packaged in your BAR file, open the bar-descriptor.xml and in the editor go to the Assets page. Select the All Configurations and drag your image file from the project explorer to the assets table. 

 

If you edit the bar-descriptor.xml manually in a text editor add the following asset element inside the root 'qnx' node:

<asset path="my_image.png">my_image.png</asset>

Now in your main.c you can update the line that loads the image to:

bbutil_load_texture("app/native/my_image.png", NULL, NULL, &tex_x, &tex_y, &background)