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

Re: How to check if image available on asset

Hi any idea how to to this?

 

Thanks

New Developer
Posts: 10
Registered: ‎01-11-2013
My Device: Torch 9800
My Carrier: Vodafone AU

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

Re: How to check if image available on asset

Hi, thanks your suggestion solve my problem.

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

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
{
 
}