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
Kaz32
Posts: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha
Accepted Solution

How to check if image available on asset

Hi I want to add image on my Action Item

How to check if image available on asset using C++?

 

If not available I will not set image source so it will use default image

 

Thanks

Developer
Kaz32
Posts: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha

Re: How to check if image available on asset

Hi any idea how to to this?

 

Thanks

New Developer
pocketmouse
Posts: 10
Registered: ‎01-11-2013
My Device: Torch 9800

Re: How to check if image available on asset

Hey,

 

I found this page:

 

https://developer.blackberry.com/cascades/reference/bb__cascades__actionitem.html

 

There are C++ and QML examples there - hope that helps!

Developer
Kaz32
Posts: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha

Re: How to check if image available on asset

Hi, thanks your suggestion solve my problem.

Developer
Kaz32
Posts: 237
Registered: ‎11-24-2012
My Device: Blackberry 10 Dev Alpha

Re: How to check if image available on asset

Hi just add this (If you want not use default setting image when image not available)

 

I look on this example:

https://github.com/blackberry/Cascades-Samples/blob/master/quotes/src/customsqldatasource.cpp

 

If you want to check image exists

 

QString dataFolder = QDir::currentPath();
QString newFileName = dataFolder + "/app/native/assets/images/" + fileName;
QFile newFile(newFileName);
 
if (newFile.exists)
{
 
}
else
{
 
}