Code example for MapView

Methods: addView, getMap, onCreate

-1
        //addContentView(mapView,  
        	//	new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT , ViewGroup.LayoutParams.MATCH_PARENT )); 
         
        //setUpMapIfNeeded(); 
        /**/ 
        mapView = new MapView(this);
        setContentView(mapView);
        mapView.onCreate(savedInstanceState);
        mapView.addView(glView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT ,
        		ViewGroup.LayoutParams.MATCH_PARENT ));
        setUpMapIfNeeded(); 
         
 
        ViewServer.get(this).addWindow(this);
    } 
 
    @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();
 
        //setUpMapIfNeeded(); 
         
        ViewServer.get(this).setFocusedWindow(this);
    } 
 
    @Override 
    protected void onPause() { 
        mapView.onPause();
    	 
        super.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();
    } 
 
    @Override 
    protected void onDestroy() { 
        mapView.onDestroy();
    	 
        super.onDestroy(); 
    	 
        ViewServer.get(this).removeWindow(this);
    } 
 
    @Override 
    public void onLowMemory() { 
        super.onLowMemory(); 
        mapView.onLowMemory();
    } 
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        mapView.onSaveInstanceState(outState);
    } 
 
    private void setUpMapIfNeeded() { 
        if (map == null) {
            map = mapView.getMap();
            if (map != null) {
                setUpMap(); 
            } 
        } 
    }