Unless this application code looks fine but it can't be running due unclear mistake can be in Oncreate activity. Please I need You help. Thanks & regards. mrajab
03-28 22:58:52.717: W/dalvikvm(3689): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 03-28 22:58:52.736: E/AndroidRuntime(3689): FATAL EXCEPTION: main 03-28 22:58:52.736: E/AndroidRuntime(3689): java.lang.RuntimeException: Unable to start activity ComponentInfo{test.map/test.map.TestActivity}: java.lang.IllegalArgumentException: provider=network 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1956) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 1981) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.ActivityThread.access$600(ActivityThread.java:123) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.os.Handler.dispatchMessage(Handler.java:99) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.os.Looper.loop(Looper.java:137) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.ActivityThread.main(ActivityThread.java:4424) 03-28 22:58:52.736: E/AndroidRuntime(3689): at java.lang.reflect.Method.invokeNative(Native Method) 03-28 22:58:52.736: E/AndroidRuntime(3689): at java.lang.reflect.Method.invoke(Method.java:511) 03-28 22:58:52.736: E/AndroidRuntime(3689): at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:784) 03-28 22:58:52.736: E/AndroidRuntime(3689): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 03-28 22:58:52.736: E/AndroidRuntime(3689): at dalvik.system.NativeStart.main(Native Method) 03-28 22:58:52.736: E/AndroidRuntime(3689): Caused by: java.lang.IllegalArgumentException: provider=network 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.os.Parcel.readException(Parcel.java:1331) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.os.Parcel.readException(Parcel.java:1281) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.location.ILocationManager$Stub $Proxy.requestLocationUpdates(ILocationManager.java:646) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.location.LocationManager._requestLocationUpdates(LocationManager.java: 582) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.location.LocationManager.requestLocationUpdates(LocationManager.java: 446) 03-28 22:58:52.736: E/AndroidRuntime(3689): at test.map.TestActivity.onCreate(TestActivity.java:31) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.Activity.performCreate(Activity.java:4465) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1049) 03-28 22:58:52.736: E/AndroidRuntime(3689): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 1920) 03-28 22:58:52.736: E/AndroidRuntime(3689): ... 11 more this is was My classes: ///MyPositionOverlay: package test.map; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.RectF; import android.location.Location; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import com.google.android.maps.Projection; public class MyPositionOverlay extends Overlay { private final int mRadius = 5; Location location; public Location getLocation() { return location; } public void setLocation(Location location) { this.location = location; } @Override public boolean onTap(GeoPoint point, MapView mapView) { return false; } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { Projection projection = mapView.getProjection(); if ((shadow == false) && (location != null)) { // Get the current location Double latitude = location.getLatitude()*1E6; Double longitude = location.getLongitude()*1E6; GeoPoint geoPoint; geoPoint = new GeoPoint(latitude.intValue(),longitude.intValue()); // Convert the location to screen pixels Point point = new Point(); projection.toPixels(geoPoint, point); RectF oval = new RectF(point.x - mRadius, point.y - mRadius, point.x + mRadius, point.y + mRadius); // Setup the paint Paint paint = new Paint(); paint.setARGB(250, 255, 255, 255); paint.setAntiAlias(true); paint.setFakeBoldText(true); Paint backPaint = new Paint(); backPaint.setARGB(175, 50, 50, 50); backPaint.setAntiAlias(true); RectF backRect = new RectF(point.x + 2 + mRadius, point.y - 3*mRadius, point.x + 65, point.y + mRadius); // Draw the marker canvas.drawOval(oval, paint); canvas.drawRoundRect(backRect, 5, 5, backPaint); canvas.drawText("Here I Am", point.x + 2*mRadius, point.y, paint); } super.draw(canvas, mapView, shadow); } } ///CurrentLocation : package test.map; import java.io.IOException; import java.util.List; import java.util.Locale; import android.content.Context; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.widget.TextView; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; public class CurrentLocation extends MapActivity{ protected boolean isRouteDisplayed() { return false; } MapController mapController; MyPositionOverlay positionOverlay; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); MapView myMapView = (MapView)findViewById(R.id.mapview); mapController = myMapView.getController(); myMapView.setSatellite(true); myMapView.setStreetView(true); myMapView.displayZoomControls(false); mapController.setZoom(17); // Add the MyPositionOverlay positionOverlay = new MyPositionOverlay(); List<Overlay> overlays = myMapView.getOverlays(); overlays.add(positionOverlay); LocationManager locationManager; String context = Context.LOCATION_SERVICE; locationManager = (LocationManager)getSystemService(context); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.POWER_LOW); String provider = locationManager.getBestProvider(criteria, true); Location location = locationManager.getLastKnownLocation(provider); updateWithNewLocation(location); locationManager.requestLocationUpdates(provider, 2000, 10, locationListener); } private final LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { updateWithNewLocation(location); } public void onProviderDisabled(String provider){ updateWithNewLocation(null); } public void onProviderEnabled(String provider){ } public void onStatusChanged(String provider, int status, Bundle extras){ } }; private void updateWithNewLocation(Location location) { String latLongString; TextView myLocationText; myLocationText = (TextView)findViewById(R.id.myLocationText); String addressString = "No address found"; if (location != null) { // Update my location marker positionOverlay.setLocation(location); // Update the map location. Double geoLat = location.getLatitude()*1E6; Double geoLng = location.getLongitude()*1E6; GeoPoint point = new GeoPoint(geoLat.intValue(), geoLng.intValue()); mapController.animateTo(point); double lat = location.getLatitude(); double lng = location.getLongitude(); latLongString = "Lat:" + lat + "\nLong:" + lng; double latitude = location.getLatitude(); double longitude = location.getLongitude(); Geocoder gc = new Geocoder(this, Locale.getDefault()); try { List<Address> addresses = gc.getFromLocation(latitude, longitude, 1); StringBuilder sb = new StringBuilder(); if (addresses.size() > 0) { Address address = addresses.get(0); for (int i = 0; i < address.getMaxAddressLineIndex(); i++) sb.append(address.getAddressLine(i)).append("\n"); sb.append(address.getLocality()).append("\n"); sb.append(address.getPostalCode()).append("\n"); sb.append(address.getCountryName()); } addressString = sb.toString(); } catch (IOException e) {} } else { latLongString = "No location found"; } myLocationText.setText("Your Current Position is:\n" + latLongString + "\n" + addressString); } // Manifest permission <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en