Code example for MapView

Methods: getMaponCreate

0
        //set translucent view 
        glView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
        // put glView on the top of window 
        glView.setZOrderOnTop(true);
 
        mapView = new MapView(this);
        mapView.onCreate(savedInstanceState);
         
        addContentView(mapView, 
        		new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT , ViewGroup.LayoutParams.MATCH_PARENT));
        glView.getParent().bringChildToFront(glView);
 
        setUpMapIfNeeded(); 
 
        ViewServer.get(this).addWindow(this);
	} 
 
	@Override 
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		mapView.onSaveInstanceState(outState);
	} 
 
	@Override 
	protected void onDestroy() { 
		mapView.onDestroy();
        ViewServer.get(this).removeWindow(this);
		super.onDestroy(); 
	} 
 
	@Override 
	public void onLowMemory() { 
		mapView.onDestroy();
		super.onLowMemory(); 
	} 
 
	@Override 
	protected void onPause() { 
		mapView.onPause();
        // The following call pauses the rendering thread. 
        // If your OpenGL application is memory intensive, 
        // you should consider de-allocating objects that 
        // consume significant memory here. 
        glView.onPause();
		super.onPause(); 
	} 
 
	@Override 
	protected void onResume() { 
		super.onResume(); 
		mapView.onResume();
        // The following call resumes a paused rendering thread. 
        // If you de-allocated graphic objects for onPause() 
        // this is a good place to re-allocate them. 
        glView.onResume();
 
        ViewServer.get(this).setFocusedWindow(this);
	} 
 
    private void setUpMapIfNeeded() { 
        if (map == null) {
            map = mapView.getMap();
            if (map != null) {
                setUpMap(); 
            } 
        } 
    }