--- android/MockLocation/src/dk/thoerup/mocklocation/MockLocationView.java 2009/09/29 19:40:07 359 +++ android/MockLocation/src/dk/thoerup/mocklocation/MockLocationView.java 2009/09/29 19:50:32 360 @@ -19,6 +19,7 @@ public class MockLocationView extends ListActivity { /** Called when the activity is first created. */ + private static final String PROVIDERNAME = "gps"; LocationManager locationManager; @@ -65,8 +66,8 @@ @Override protected void onResume() { super.onResume(); - LocationProvider gps2 = locationManager.getProvider("gps2"); - isEnabled = (gps2 != null); + LocationProvider provider = locationManager.getProvider(PROVIDERNAME); + isEnabled = (provider != null); enableButtons(); Log.e("onResume", "onResume"); } @@ -94,8 +95,8 @@ View.OnClickListener enableListener = new View.OnClickListener() { public void onClick(View v) { - locationManager.addTestProvider("gps2", false, true, true, false, false, false, false, 0, Criteria.ACCURACY_FINE ); - locationManager.setTestProviderEnabled("gps2", true); + locationManager.addTestProvider(PROVIDERNAME, false, true, true, false, false, false, false, 0, Criteria.ACCURACY_FINE ); + locationManager.setTestProviderEnabled(PROVIDERNAME, true); isEnabled = true; @@ -105,7 +106,7 @@ View.OnClickListener disableListener = new View.OnClickListener() { public void onClick(View v) { - locationManager.removeTestProvider("gps2"); + locationManager.removeTestProvider(PROVIDERNAME); isEnabled = false; enableButtons(); @@ -120,11 +121,11 @@ LocationBean bean = locations.get(selected); - Location loc = new Location("gps2"); + Location loc = new Location(PROVIDERNAME); loc.setLatitude( bean.getLatitude() ); loc.setLongitude( bean.getLongitude() ); - locationManager.setTestProviderLocation("gps2", loc); + locationManager.setTestProviderLocation(PROVIDERNAME, loc); } else { Log.e("mocklocation", "No item selected " + selected); }