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: 63
Registered: ‎12-16-2011
My Device: Red 10
My Carrier: Mobifone

NDK studio Cannot preview image using ImageView control

Hi

 

I'm using QNX Momentics IDE in windows 7 to learn Cascade. From some tutorial, I found the ImageView to display an image and try to follow.

In the tutorial I can see it's able to preview the image, but I cant.

 

My code sample below. Can you please help to answer why?

 

 

 

Page {

//root container
Container {
layout: DockLayout {}
Container {
id: imagaeContainerID
layout: DockLayout{}
ImageView {
id: dayimg
imageSource: "asset:///images/day.jpg"
}
}
}
}

 

 

Developer
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: NDK studio Cannot preview image using ImageView control

[ Edited ]

Works for me. Obviously I used a different image than you did so maybe there is something wrong with your image.  Or a possibly dumb question but you do have an image called "day.jpg" in a folder called "images" inside of assets, right?

 

EDIT: adding screenshot

imgview_forum.png

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Developer
Posts: 63
Registered: ‎12-16-2011
My Device: Red 10
My Carrier: Mobifone

Re: NDK studio Cannot preview image using ImageView control

Yes there is an image named "day.jpg" in assets/images folder.
Developer
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: NDK studio Cannot preview image using ImageView control

Have you tried any other images? Because as you see from my screenshot I didn't change anything other than the image name to an image I had on my computer and it shows up with your code.

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: NDK studio Cannot preview image using ImageView control

I have this same issue with the Momentics IDE on a Mac.  It won't show the image in the QML preview, but when I test on the device it shows the image.

Highlighted
Developer
Posts: 194
Registered: ‎11-24-2012
My Device: Dev Alpha B, Bold 9700
My Carrier: NA

Re: NDK studio Cannot preview image using ImageView control

[ Edited ]

I converted the "night.jpg" image to a png file ("night.png") and it shows fine, so maybe its a jpg issue?

 

Don't know why bcs925 isn't having this problem.