public class Act1 extends MapActivity
private MapController mc;
private LocationManager locationManager;
private MyLocationOverlay myLocationOverlay;
private String tvLatitudine;
private String tvLongitudine;
private TextView tvLatitudine2;
private TextView tvLongitudine2;
protected boolean _active = true;
protected int _splashTime = 5000;
private int time_total=5000;
private int time_tick=1000;
private Intent login_user;
private Intent login_user_search;
private Intent login_user_myfriends;
private Intent login_user_myfollower;
private Intent login_user_mynewfollower;
private String pkg_search=null;
private String pkg_myfriends=null;
private String pkg_myfollower=null;
private String pkg_mynewfollower=null;
private int new_follower;
private Handler handler = new Handler();
private Handler handler2 = new Handler();
@Override public void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mc = mapView.getController();
final Runnable update_position = new Runnable()
handler.postDelayed(this, 8000);
final Runnable see_friends = new Runnable()
Drawable img = getResources().getDrawable(R.drawable.pushpin);
Posizioneutente overlays_interesse = new Posizioneutente(getBaseContext(),img,ltt,lng);
mapView.getOverlays().add(overlays_interesse);
handler2.postDelayed(this, 8000);
protected boolean isRouteDisplayed() {
public boolean onCreateOptionsMenu(Menu menu)
super.onCreateOptionsMenu(menu);
menu.add(0,0,1,"I'm here!").setIcon(R.drawable.imhere);
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
boolean isGPS = locationManager.isProviderEnabled (LocationManager.GPS_PROVIDER);
myLocationOverlay = new MyLocationOverlay(this, mapView);
List<Overlay> overlays = mapView.getOverlays();
overlays.add(myLocationOverlay);
myLocationOverlay.enableMyLocation();
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0, new GeoUpdateHandler());
handler.postDelayed(update_position, 8000);
handler2.postDelayed(see_friends, 8000);
public class GeoUpdateHandler implements LocationListener
public void onLocationChanged(Location location)
int lat = (int) (location.getLatitude() * 1E6);
int lng = (int) (location.getLongitude() * 1E6);
tvLatitudine=Double.toString(getRound(location.getLatitude(), 5));
tvLongitudine=Double.toString(getRound(location.getLongitude(), 5));
public void onProviderDisabled(String provider) {}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public static double getRound(double x, int digits)
double powerOfTen = Math.pow(10, digits);
return ((double)Math.round(x * powerOfTen) / powerOfTen);