I'm new to this and it has taken lots of time trying to figure this out. I have this code below as it seems not to be working and sometimes crashes. I know it might be a little thing holding it but would need help to get it fixed and running.
Can someone help in correcting please as i want to learn as well.
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 android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends MapActivity {
protected static final GeoPoint Geopoint = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView view = (MapView) findViewById(R.id.mapview);
view.setBuiltInZoomControls(true);
final MapController control = view.getController();
LocationManager manager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
LocationListener listener = null;
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener);
//control.setCenter(new GeoPoint((int)((LocationManager) manager).getLatitude(), (int)((LocationManager) manager).getLongitude()));
}
@Override
protected boolean isRouteDisplayed() {
return false;
}