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
raju504
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Getting problem when inserting map view dynamically

Hi

 

      I have a component definition in the attached objects of a container. When clicked on defferent buttons of the container, I am changing the source of the component definition and inserting to the container. I have succeeded with several buttons but when I insert the container which has the map view, the mapview is not loading. Is there any problem with mapview that is dynamically inserted to the container (OR) is it not possible to load map if we insert dynamically?

 

Thanks in advance!

- Raju

- Raju
Please use plain text.
Developer
ekke
Posts: 1,510
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Getting problem when inserting map view dynamically

I had a problem with MapView if attached normaly:

the Map was empty and endless Console output from Rendering Engine

 

could fix this with dynamic components.

 

this works for me:

here's the Component

ComponentDefinition {
            id: singleSiteMapComponent
            source: "../maps/MapOfSingleSite.qml"
        }

this is the property dfor the component:

property variant mapPage;

 

and here's the code to open the MapView

function pushSingleSiteMap(latitude, longitude) {
        mapPage = singleSiteMapComponent.createObject(navigationPane)
        console.log("lat: " + latitude + " lon: " + longitude)
        mapPage.latitude = latitude
        mapPage.longitude = longitude
        navigationPane.push(mapPage)
    } 

and at last step the code to destroy

onPopTransitionEnded: {
        if (mapPage == page) {
            console.debug("map destroyed !!")
            mapPage.destroy()
        }
    }

 to get the whole picture, here's the code from Page with MapView to get the coordinates

Page {
    property alias latitude: mapview.latitude
    property alias longitude: mapview.longitude

 Now using the dynamic way the MapView works :smileyhappy:

 

with some limitations:

  • first startup after opening the app can take up to 20 seconds
  • opening the Page with the Map for 2-3 seconds you see a black screen before the Map "arrives"
  • rendering of the Map is a desaster, not all tiles are rendered well

On Dev Alpha repeatedly switching between Map and other Page (create / destroy) in some cases the MapView stops rendering, screen black only and it happens rarely that I couldn't close the App and had to restart the DevAlpha.

 

But I got info from RIM that this should be better at launch

Compared with new GoogleMaps API v2 for Android from December 2012 at the moment MapView is way behind.

I need only 50% of code for GoogleMap API v2 and rendering is smooth and Camera-Animations are cool.

 

So - at the moment - from my POV it's only the Map where Android4 works better - in all other components I'm using for complex business apps, BlackBerry 10 is much better.

 

Hope, that BB10 Devs at RIM will spent some more time to get a cool Map-UX at launch. This is important because reviews will be sensible in this part after the iOS6 - map-desaster

 

thanks to Shadid Haque we now have a great CustomMapView sample at Github. get it, integrate it into your apps and report all problems you find to give the devs the chance to fix OS before launch

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
raju504
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Re: Getting problem when inserting map view dynamically

Thanks ekke! I will see that sample now...!

- Raju

- Raju
Please use plain text.
Contributor
velkin
Posts: 34
Registered: ‎10-28-2012
My Device: Dev Alpha B
My Carrier: Rogers

Re: Getting problem when inserting map view dynamically

No need to switch "back and forth" between pages to cause the crash....Even in the CustomMapView, simply swipe down from the top to display the menu (there is nothing in the menu...but it doesn't matter), and then touch the map again. The app will explode and the map will stop working with:

 

eglSwapBuffers: an EGLSurface argument does not name a valid surface configured for rendering
NBRE_GLTexture::Create2DTexture: glGenTextures failed! texture name=InternalTexture, nbmID=T_BR13_2_PNG_23_2374_2933, offset=0, memory addr=a1e0020 glError = 0

 

 

*Like or mark as solution!*
Please use plain text.