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: 151
Registered: ‎10-30-2010
My Device: Priv
My Carrier: T-Mobile
Accepted Solution

Posting photo from .xml

[ Edited ]

Hi there. I'm a WebWorks developer / web developer that decided to transition towards Cascades for my app. I've been fine creating ListView components and Labels using data pulled from a custom .xml I created.

 

The issue I'm having on one page is that I can't display a photo using the ImageView component. I know I'm doing it wrong since I'm basically copying the model used for pulling text and attaching it to the id of a Label.

 

--
import bb.cascades 1.0

 

Page {
property alias driverName : driverNameLabel.text
property alias driverPhoto : driverPhotoLabel.text


Container {

 

Label {
id: driverNameLabel
}


ImageView {
imageSource: driverPhotoLabel
}


}
}

---

 

This is in its own .QML and was "pushed" by a previous .QML file that consists of a ListView using the same xml file where each list item is displayed. Basically it is a list of race drivers and when one is selected, I'd like it to go to the same .QML with some general information and statistics. The main photo of the driver is what I'm having the trouble on. I can display the "driverPhoto" URL just fine using a Label with it's text, I just can't apply it to an ImageView.

 

I hope I'm not in too deep without having a lot of knowledge of programming. QML has made this a little more accessible for me.

 

Thank you! Smiley Happy

 

Highlighted
Developer
Posts: 151
Registered: ‎10-30-2010
My Device: Priv
My Carrier: T-Mobile

Re: Posting photo from .xml

After searching around through samples, the stamp collector sample app showed me the solution.

 

property alias driverPhoto : driverPhotoLabel.text

 

 

was changed to

 

property alias driverPhoto : driverPhotoLabel.imageSource

 

then I applied this id to the ImageView component.

 

ImageView {
id: driverPhotoLabel
}