View difference between Paste ID: 5gZjKfM8 and jFEwKHD5
SHOW: | | - or go back to the newest paste.
1
package com.phoenixpark.app;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import android.annotation.SuppressLint;
7
import android.app.AlertDialog;
8
import android.content.Context;
9
import android.content.DialogInterface;
10
import android.location.Criteria;
11
import android.location.Location;
12
import android.location.LocationListener;
13
import android.location.LocationManager;
14
import android.location.LocationProvider;
15
import android.os.Bundle;
16
import android.support.v4.app.FragmentActivity;
17
import android.view.Menu;
18
import android.view.MenuItem;
19
import android.widget.Toast;
20
21
import com.google.android.gms.maps.CameraUpdateFactory;
22
import com.google.android.gms.maps.GoogleMap;
23
import com.google.android.gms.maps.SupportMapFragment;
24
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
25
import com.google.android.gms.maps.model.LatLng;
26
import com.google.android.gms.maps.model.Marker;
27
import com.google.android.gms.maps.model.MarkerOptions;
28
29
public class MapPark extends FragmentActivity implements LocationListener
30
{
31
    GoogleMap map;
32-
    ArrayList<LatLng> markerPoints;
32+
33
    LatLng phoenixpark;
34
    Location loc;
35
    protected LocationManager locationManager;
36
    protected LocationListener locationListener;
37
    protected String latitude,longitude;
38
    private LocalDbManager locations_db, food_db, parking_db;
39
    public String the_location;
40
 
41
    @Override
42
    protected void onCreate(Bundle savedInstanceState) 
43
    {
44
        super.onCreate(savedInstanceState);
45
        setContentView(R.layout.mappark_layout);
46
 
47
        // Getting reference to SupportMapFragment of the activity_main
48-
        // Initializing
48+
49-
        markerPoints = new ArrayList<LatLng>();
49+
50
        // Getting Map for the SupportMapFragment
51
        map = fm.getMap();
52
        
53
        Criteria criteria = new Criteria();
54
55
        // Getting the name of the best provider
56
        String provider = locationManager.getBestProvider(criteria, true);
57
58
        // Get the parks location
59
        location = locationManager.getLastKnownLocation(provider);
60
	phoenixpark = new LatLng(53.356065, -6.329665);
61
62
	// Zoom into the parks location when the activity starts
63
	map.moveCamera(CameraUpdateFactory.newLatLng(phoenixpark));
64
	map.animateCamera(CameraUpdateFactory.zoomTo(13));
65
66
	// add markers
67
	addMarkers();
68
    }
69
70
    // Add location markers to the map
71
    private void addMarkers() 
72
    {
73
         MarkerOptions marker_name = new MarkerOptions().position(new LatLng
74
            			(53.359772, -6.317010);
75
         marker_name.icon(BitmapDescriptorFactory.fromResource(R.drawable.attraction_icon));
76
         marker_name.title("Aras an Uachtarain");
77
         map.addMarker(marker_name);
78
79
	 MarkerOptions marker_name2 = new MarkerOptions().position(new LatLng
80
            			(53.355663, -6.304805);
81
        marker_name2.icon(BitmapDescriptorFactory.fromResource(R.drawable.attraction_icon));
82
        marker_name2.title("Dublin Zoo");
83
        map.addMarker(marker_name2);
84
    }
85
}