package com.incidentlocator.client;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import android.content.Context;
import android.location.LocationManager;

import android.location.Location;
import android.location.LocationListener;
//import android.location.LocationManager;
//import android.os.Bundle;


public class IncidentLocator extends Activity
{

    protected LocationManager locationManager;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        locationManager =
            (LocationManager) getSystemService(Context.LOCATION_SERVICE);

        // TODO: request both gps and network updates
        locationManager.requestLocationUpdates(
            LocationManager.GPS_PROVIDER, 0, 0, new GetLocationListener());
    }

    public class GetLocationListener implements LocationListener {

        @Override
        public void onLocationChanged(Location loc) {
            // do something
        }

        @Override
        public void onProviderDisabled(String provider) {}

        @Override
        public void onProviderEnabled(String provider) {}

        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {}

    }

    public void getLocation(View view) {
        String message = "Hello from incident Locator";

        TextView textView = (TextView) findViewById(R.id.show_message);
        textView.setText(message);
    }
}

@@ -365,16 +365,41 @@
 Bundle;%0A
+import android.util.Log;%0A
 %0A%0Apublic
@@ -444,54 +444,200 @@
 y%0A%7B%0A
-%0A    protected LocationManager locationManager
+    private static final String TAG = %22IncidentLocator%22;%0A%0A    protected LocationManager locationManager;%0A%0A    private static int lat;%0A    private static int lng;%0A%0A    private TextView textView
 ;%0A%0A 
@@ -841,24 +841,88 @@
 out.main);%0A%0A
+        textView = (TextView) findViewById(R.id.show_message);%0A%0A
         loca
@@ -1351,23 +1351,286 @@
     
-// do something
+lat = (int) (loc.getLatitude()*1E6);%0A            lng = (int) (loc.getLongitude()*1E6);%0A            Log.d(TAG, %22lat=%22 + lat);%0A            Log.d(TAG, %22lng=%22 + lng);%0A%0A            String message = Integer.toString(lat) + Integer.toString(lng);%0A            textView.setText(message);
 %0A   

add logging for debug