Android Open Source - android-openmap-framework Custom Map Activity






From Project

Back to project page android-openmap-framework.

License

The source code is released under:

Apache License

If you think the Android project android-openmap-framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jwetherell.openmap.activity;
//  w ww.j a v  a  2  s.  co m
import android.os.Bundle;
import android.widget.FrameLayout;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.jwetherell.openmap.R;


/**
 * This abstract class extends Activity to handle drawing the map and setting
 * the default options.
 * 
 * @author Justin Wetherell <phishman3579@gmail.com>
 */
public abstract class CustomMapActivity extends MapActivity {

    protected static MapView mapView = null;
    protected static MapController mapController = null;

    private static int zoomLevel = 18;

    /**
     * {@inheritDoc}
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        // Create the MapView using my API key
        mapView = new MapView(this, getResources().getString(R.string.mapKey));
        mapView.setSatellite(true);
        mapView.setKeepScreenOn(true);

        // Add the map view to the map frame
        FrameLayout mapFrame = (FrameLayout) this.findViewById(R.id.MapFrame);
        mapFrame.addView(mapView);

        // Set the map controller
        mapController = mapView.getController();

        // Move the map view to the point
        mapController.setZoom(zoomLevel);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }
}




Java Source Code List

com.jwetherell.openmap.activity.CenteredMapActivity.java
com.jwetherell.openmap.activity.CustomMapActivity.java
com.jwetherell.openmap.activity.OpenMapDemo.java
com.jwetherell.openmap.activity.configure.ConfigureUser.java
com.jwetherell.openmap.common.Ellipsoid.java
com.jwetherell.openmap.common.GreatCircle.java
com.jwetherell.openmap.common.LatLonPoint.java
com.jwetherell.openmap.common.Length.java
com.jwetherell.openmap.common.MGRSPoint.java
com.jwetherell.openmap.common.MoreMath.java
com.jwetherell.openmap.common.Planet.java
com.jwetherell.openmap.common.ProjMath.java
com.jwetherell.openmap.common.UTMPoint.java
com.jwetherell.openmap.common.ZonedUTMPoint.java
com.jwetherell.openmap.data.MessageUtilities.java
com.jwetherell.openmap.data.UserData.java
com.jwetherell.openmap.overlay.HashMapItemizedOverlay.java
com.jwetherell.openmap.utilities.Utilities.java