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
Highlighted
Contributor
Posts: 31
Registered: ‎09-25-2012
My Device: N/A
My Carrier: Rogers

MapView crashes when used in CustomControl

Hi all,

 

I am attempting to make my own CustomControl which will contain a MapView. So far i can dispaly the map on the emulator and move it around that works well. But as soon as I slide up from the bottom bessel or touch the top bessel the application crashes. 

 

Here is what i have so far.

 

.hpp

 

class RouteMapView: public CustomControl {

Q_OBJECT

public:

RouteMapView();
virtual ~RouteMapView();

MapView *m_mapLayer;

Container *m_rootContainer;

}

 

.cpp

 

RouteMapView::RouteMapView()
{
m_rootContainer = Container::create()
.layout(new AbsoluteLayout());

 

m_mapLayer = new MapView(m_rootContainer);

m_mapLayer->setPreferredSize(768, 1280);
m_mapLayer->setAltitude(3000);
m_mapLayer->setLatitude(43.478394);
m_mapLayer->setLongitude(-80.540896);

 

m_rootContainer->add(this->m_mapLayer);

 

setRoot(m_rootContainer);

}

 

Is there anything I am doing incorrectly with the MapView? I have run the example where the MapView is created in the QML and it does not appear to have the same crashes as I do.

 

Thanks in advance,

 

-J