TreasureMap.java :  » UnTagged » poliandroid » com » adivasile » Android Open Source

Android Open Source » UnTagged » poliandroid 
poliandroid » com » adivasile » TreasureMap.java
package com.adivasile;

import android.location.Geocoder;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class TreasureMap extends MapActivity {
  
  MapView mapView;
  MapController mc;
  GeoPoint p;
  Geocoder geoCoder;
  boolean satView=false;
  boolean streetView=true;
  
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map);
    
        mapView = (MapView) findViewById(R.id.mapView);
        mc = mapView.getController();
        p = new GeoPoint((int)(44.4 * 1E6),(int)(26.1 * 1E6));
        mc.animateTo(p);
        mc.setZoom(17);
        mapView.setSatellite(satView);
        mapView.setStreetView(streetView);
        mapView.invalidate();
        
        //Map controls
        LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
        View zoomView = mapView.getZoomControls(); 
        zoomLayout.addView(zoomView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
        mapView.displayZoomControls(true);
        
        Button satelliteButton = (Button)findViewById(R.id.sat_button);
        
        satelliteButton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        if (satView) {
          mapView.setSatellite(false);
          satView = false;
        } else {
          mapView.setSatellite(true);
          satView = true;
        }
      }
    });
        
  }

  @Override
  protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.