Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
09-02-2012 07:30 PM
I've created a flat list view using the Grouping:None technique mentioned here:
I'm trying to change my list to display differently based on the type, as indicated in the JSON. My first category in my JSON is type , but I can't seem to get that to display the list correctly.
I've been able to do it in XML but can't do it in JSON. Anyone have any suggestions?
Solved! Go to Solution.
09-04-2012 02:09 PM
Both of those examples only base it upon index.length. There is no example that includes more complex comparisons based on the actual data content.
So back to my example
JSON is formatted this way:
I was struggling with how to access the string variable with the JSON and then how to do a string comparison. How do I complete the code below?
// if type is "image" then
return = " image"
// if type is "image" then
09-06-2012 10:14 PM
I think a lot more developers need help with parsing different types of JSON data structures, and background on how to do this in C++/Qml. I think that super apps or custom applications launching on BB10 will call apis; the apis will be internal to their application, or 3rd party apis.
09-09-2012 01:02 AM
In C++ I've been able to output the format of data(indexPath).
How do I access the "type" in the QVariant?
QVariant(QVariantMap, QMap(("URL", QVariant(QString, "../../../shared/camera/IMG_00000005.jpg") ) ( "infoText" , QVariant(QString, " ") ) ( "thumbURL" , QVariant(QString, "../../../shared/camera/IMG_00000005.jpg") ) ( "type" , QVariant(QString, "item") ) ) )
09-09-2012 04:09 AM
09-09-2012 08:42 AM
Had to use a couple of them in fact!
data(indexPath).toMap().value("type").toString() = "item"
09-09-2012 10:16 PM
An alternate method in QML is to do the following
var chosenItem = dataModel.data(indexPath); return chosenItem.type