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

New Contributor
Posts: 2
Registered: ‎03-25-2013
My Device: q10
My Carrier: aircel

Using Camera in Navigation Pane

[ Edited ]

IAm developiong an app where i primarly take photos .I use various pages where the Master page will be my page with a Camera .But when i simple design my page without Navigationpane iam able to see a camera ,but when i use a navigation pane the whole screen dissapears .i have used the Photobomber app as my reference .I have also added my code here .


import bb.cascades 1.0
import bb.cascades.multimedia 1.0
import bb.multimedia 1.0
import bb.system 1.0
Page {
id: photoPage

actions: [
// define the actions for first tab here

ActionItem {

title: qsTr("Next")
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
var page = secondPageDefinition.createObject();

imageSource: "asset:///images/ic_forward.png"
] // A Container is used to gather visual items together.

Container {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill

layout: DockLayout {

background: Color.DarkBlue
// This is the camera control that is defined in the cascades multimedia library.
Camera {
id: camera
objectName: "myCamera"
onTouch: {
if (event.isDown()) {
// Take photo

// When the camera is opened we want to start the viewfinder
onCameraOpened: {
// Using helper function to set resolution. 1/1 for 720 x 720 displays.
// _photoBomber.selectAspectRatio(camera, 1 / 1);

// Additional camera settings, setting focus mode and stabilization
cameraSettings.focusMode = CameraFocusMode.ContinuousAuto
cameraSettings.shootingMode = CameraShootingMode.Stabilization

// There are loads of messages we could listen to here.
// onPhotoSaved and onShutterFired are taken care of in the C++ code.
onCameraOpenFailed: {
console.log("onCameraOpenFailed signal received with error " + error);
onViewfinderStartFailed: {
console.log("viewfinderStartFailed signal received with error " + error);
onViewfinderStopFailed: {
console.log("viewfinderStopFailed signal received with error " + error);
onPhotoCaptureFailed: {
console.log("photoCaptureFailed signal received with error " + error);
onPhotoSaveFailed: {
console.log("photoSaveFailed signal received with error " + error);
onPhotoSaved: {
// _photoBomber.manipulatePhoto(fileName);
// Will set the filename of the latest captured bomber photo in the ImageButton property.
setting.lastFileName = fileName;
// Makes the ImageButton visible when a photo is captured.
setting.visible = true;

onCreationCompleted: {
// Open the front facing camera.

attachedObjects: [
CameraSettings {
id: cameraSettings
verticalAlignment: VerticalAlignment.Fill
horizontalAlignment: HorizontalAlignment.Fill
scaleX: 1.1
scaleY: 1.0

ImageButton {
id: setting
property string lastFileName: ""
visible: false
defaultImageSource: "asset:///images/settings_unpressed.png"
pressedImageSource: "asset:///images/settings_pressed.png"
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Bottom

onClicked: {
//Show the latest bomber image available. Takes the ImageButtons Property as argument.
attachedObjects: [
ComponentDefinition {
id: secondPageDefinition
source: "crimelist.qml"


// show detail page


Posts: 1,177
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Using Camera in Navigation Pane

Hello starsurya1992 and welcome to the forums. It is very difficult for others to grasp your code when it is not formatted correctly. Please edit your post and repaste your code using the "Insert Code" button on the toolbar above the edit field. You will get a better response if you do.



Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.