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: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Trying to load images from /shared/camera into a list

Can someone please help me...I am trying to load my camera roll pics into a list. It just doesn't seem to want to connect in anyway...I have read everything on the web that I think would help and had a helper (developer) look at it and I can not seem to get it right.

 

I have attached my code for the 3 files that pertain to me doing this. Any guidance would be so appreciated...Thank you in advance.

 

Cheers,

 

Daniel

 

 

File: Listview Page

 

import bb.cascades 1.0

 

 

Page {

id: first

 

BackgroundContainer {

 

ListView {

dataModel: XmlDataModel {

source: "model.xml"

}

listItemComponents: [

ListItemComponent {

type: "item"

PhotoListItem {

}

}

]

 

}}}

 

 

 

 

File: PhotoListItem

 

import bb.cascades 1.0

 

 

ScrollView {

overlapTouchPolicy: OverlapTouchPolicy.Allow

scrollViewProperties.overScrollEffectMode: OverScrollEffectMode.OnPinchAndScroll

scrollViewProperties {

scrollMode: ScrollMode.Horizontal

minContentScale: .8

maxContentScale: 2.0

pinchToZoomEnabled: true

initialScalingMethod: ScalingMethod.None

 

}

Container {

 

ImageView {

imageSource: "/accounts/1000/shared/camera/"+ListItemData.image

scalingMethod: ScalingMethod.AspectFit

}}}

 

 

 

 

File: model.xml

 

<model>

<item image="*.*"/>

</model>

Simplify your Life...
Developer
Posts: 67
Registered: ‎09-01-2012
My Device: Dev Alpha
My Carrier: Bell

Re: Trying to load images from /shared/camera into a list

Did you give your app permission to access the shared folders?
Developer
Posts: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Re: Trying to load images from /shared/camera into a list

Yes I checked and I have permissions set correctly.

Simplify your Life...
Highlighted
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: Trying to load images from /shared/camera into a list

Did you try changing "/accounts/1000/shared/camera/" to "file:///accounts/1000/shared/camera/file"? Or try to let the datamodel return the full path.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 36
Registered: ‎04-19-2012
My Device: Z30, Z10, Q10, Playbook
My Carrier: Virgin

Re: Trying to load images from /shared/camera into a list

Thank you for you replys...

 

I just tried your suggestions and still not loading images...

 

I am trying to load all the camera pics in a list that I can easily scroll through in a container.

 

I also put the full path in the datamodel and no luck....I need the folder and not just one pic....this is the tricky part.

 

Thank you again.

 

Perhaps there is another way to just have a container populated with the camera pics.

Simplify your Life...
Contributor
Posts: 13
Registered: ‎11-30-2012
My Device: Alpha
My Carrier: Pepephone

Re: Trying to load images from /shared/camera into a list

I have the same problem in c++, trying

 

myImageButton->setDefaultImageSource(QUrl(QString("file:///%1").arg(fileName)));

 

where fileName is the photoSaved filename of the camara. ¿Any solution? Y have also tried without "file:///"

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Trying to load images from /shared/camera into a list

[ Edited ]

I think wildcards aren't expanded anywhere. Try replacing

<item image="*.*"/>

with a specific filename and see if image appears.
You'll have to iterate files in folder manually adding their names to data model.

 

I'd approach it this way:

- Try displaying a single image in ImageView (not in ListView) to make sure the path is correct.

- Iterate all files in camera folder adding their names to ArrayDataModel or GroupDataModel. Not sure if this can be done in QML, but you can use Qt or posix filesystem functions.

 


Andrey Fidrya, @zmeyc on twitter
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: Trying to load images from /shared/camera into a list

I seem to recall that there is a resolution limit on ImageView of 2048x2048.  Have you tried with smaller images?

Trying to load all photos un-scaled into any list sounds like a bad idea from a performance perspective given that a full 2048x2048 RGB image will consume something on the order of 12-16MB each.

Forums Advisor I
Posts: 501
Registered: ‎03-01-2013
My Device: BlackBerry Z10

Re: Trying to load images from /shared/camera into a list

Hey i am also doing the same thing..did you get any solution??