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
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

App Crashing while scrolling Grid List

Hi all,

 

In my app, i am saving some images after taking the picture. I am using the Grid List to populate the images but while scrolling the GridList my app is getting crashed. Did anyone know why it is happening...

 

Please use plain text.
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Re: App Crashing while scrolling Grid List

Will size of the image cause any memory issues? This is happening when there is more than 12 images in the grid lsit.

Please use plain text.
Developer
simon_hain
Posts: 16,001
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: App Crashing while scrolling Grid List

can you specify "crash"? a segfault? do you get a usable stacktrace when debugging?
check your code for possible nullpointer.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380
My Carrier: Vodafone

Re: App Crashing while scrolling Grid List

Hi Simon,

 

Below is my QML code

import bb.cascades 1.0
import bb.cascades.multimedia 1.0
import bb.multimedia 1.0
import bb.system 1.0

Page {
   // resizeBehavior: PageResizeBehavior.None
    Container {
        background:bg.imagePaint
        layout: AbsoluteLayout {}
        Label {
            text: qsTr("Pictures")
            layoutProperties: AbsoluteLayoutProperties {
                positionX: 30.0
                positionY: 30.0
            }
            horizontalAlignment: HorizontalAlignment.Left
            textStyle.color: Color.create("#F0B03A")
            textStyle.fontWeight: FontWeight.Bold
            textStyle.fontSize: FontSize.XLarge
            textStyle {
                base: SystemDefaults.TextStyles.TitleText
            }
        }
            ListView {
                id: picturegrid
                objectName: "picturegrid"
                layoutProperties: AbsoluteLayoutProperties {
                    positionX: 0.0
                    positionY: 140.0
                }
                layout: GridListLayout {
                    columnCount: 3
                }
                preferredHeight: 990.0
                listItemComponents: [
                    ListItemComponent {
                        type: "item"
                        MyListItem {}
                    }
                ]
                onTriggered: {
                    var curr_item = dataModel.data(indexPath)
                    picturepage.open();
                    picturepage.previewPath = curr_item.filename;
                }
                horizontalAlignment: HorizontalAlignment.Center
                verticalAlignment: VerticalAlignment.Center
            }
    }
    
    actions: [
        ActionItem {
            title: qsTr("Take Picture")
            imageSource: "asset:///actionbar/camera.png"
            ActionBar.placement: ActionBarPlacement.OnBar
            onTriggered: {
                opencamera.open();
            }
        }
    ] 
    
    attachedObjects: [
        ImagePaintDefinition{
            id: bg
            repeatPattern: RepeatPattern.Fill
            imageSource: "asset:///images/crpytbg.png"
        },        
        GroupDataModel{
            id: myGroupDataModel
        },
        Sheet{
            id:opencamera
            Page{
                resizeBehavior: PageResizeBehavior.None
                Container {
                    background: Color.Black
                    Camera{
                        id: camera
                        onCreationCompleted: {
                            if (allCamerasAccessible) {
                                open(CameraUnit.Rear);
                            }
                        }
                        onCameraOpened: {
                            getSettings(cameraSettings);
                            cameraSettings.flashMode = CameraFlashMode.Off;
                            cameraSettings.focusMode = CameraFocusMode.ContinuousAuto;
                            applySettings(cameraSettings);
                            startViewfinder();
                        }
                        onTouch: {
                            if (event.touchType === TouchType.Down) {
                                capturePhoto();
                            }
                        }
                        onPhotoCaptured: {
                            shutterSound.play();
                        }
                        onPhotoSaved:{
                            Qt.objectCrypt.savePhoto(fileName);
                            opencamera.close();
                        }
                        attachedObjects: [
                            CameraSettings{
                                id: cameraSettings
                            },
                            SystemSound{
                                id:    shutterSound
                                sound: SystemSound.CameraShutterEvent
                            }
                        ]
                    }
                }
            }
        },
        Sheet{
            id:picturepage
            property alias previewPath: previewImage.imageSource
            Page{
                resizeBehavior: PageResizeBehavior.None
                Container {
                    background:bg.imagePaint
                    layout: AbsoluteLayout {}
                    Label {
                        text: qsTr("Pictures")
                        layoutProperties: AbsoluteLayoutProperties {
                            positionX: 30.0
                            positionY: 30.0
                        }
                        horizontalAlignment: HorizontalAlignment.Left
                        textStyle.color: Color.create("#F0B03A")
                        textStyle.fontWeight: FontWeight.Bold
                        textStyle.fontSize: FontSize.XLarge
                        textStyle {
                            base: SystemDefaults.TextStyles.TitleText
                        }
                    }
                    ImageView {
                        imageSource: "asset:///images/op.png"
                        preferredWidth: 120.0
                        preferredHeight: 50.0
                        layoutProperties: AbsoluteLayoutProperties {
                            positionX: 600.0
                            positionY: 50.0
                        }
                        onTouch: {
                            picturepage.close();
                        }
                    }
                    Label{
                        text:"Close"
                        layoutProperties: AbsoluteLayoutProperties {
                            positionX: 615.0
                            positionY: 50.0
                        }
                        textStyle.fontSize: FontSize.Medium
                        textStyle.color: Color.create("#000000")
                        onTouch: {
                            picturepage.close();
                        } 
                    }
                    ImageView {
                        id:previewImage
                        objectName: "previewImage"
                        layoutProperties: AbsoluteLayoutProperties {
                            positionX: 13.0
                            positionY: 140.0
                        }
                        preferredHeight: 990
                        preferredWidth:742
                        horizontalAlignment: HorizontalAlignment.Center
                        verticalAlignment: VerticalAlignment.Center
                    
                    }
                }
                actions: [
                    InvokeActionItem {
                        id: sharetobbm
                        title: "Share"
                        ActionBar.placement: ActionBarPlacement.InOverflow
                        query {
                            mimeType: "text/plain"
                            invokeActionId: "bb.action.SHARE"
                        }
                        onTriggered: {
                        }
                    },
                    DeleteActionItem {
                        id: deleteaction
                        title: "Delete"
                        imageSource: "asset:///actionbar/ic_delete.png"
                        ActionBar.placement: ActionBarPlacement.InOverflow
                        onTriggered: {
                        }
                    }
                ] 
            }
        }
    ]
}


 

And MyListItem.qml is my custom component for Grid Image.

 

I am saving the images in misc folder and path is saved in local database.

 

The images are populated after retieving data from the database.

 

If the Gridlist is scrolled it get crashed. This is occuring only in Z10 and in Q10 it is working fine.

Please use plain text.