@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate()"); setContentView(R.layout.map); mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapOverlays = mapView.getOverlays(); pushPinMarker = this.getResources().getDrawable(R.drawable.ic_icon_map_marker); itemizedoverlay = new ObjectsItemizedOverlay(pushPinMarker, mapView); itemizedoverlay.setDestino(BikesDataActivity.class); userLocationMarker = this.getResources().getDrawable(R.drawable.ic_icon_user_location); userOverlay = new userItemizedOverlay(userLocationMarker); dndzgzApp = ((DndZgzApplication) this.getApplication()); JSONArray listJSON = dndzgzApp.getBikesList(); for (int i = 0; i < listJSON.length(); i++) { try { bikesArrayList.add((JSONObject) listJSON.get(i)); } catch (JSONException e) { e.printStackTrace(); } } Log.i(TAG, "bikesArrayList: " + bikesArrayList.size()); runnableBikes = new Runnable() { @Override public void run() { paintObjects(); } }; Thread thread = new Thread(null, runnableBikes, "PintarPuntosMapa"); thread.start(); progressDialog = ProgressDialog.show( BikesMapActivity.this, getText(R.string.espere), getText(R.string.pintando_puntos), true); locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); // Define a listener that responds to location updates locationListener = new LocationListener() { public void onLocationChanged(Location location) { showUserMarker(location); // Log.i(TAG, "LocationChanged"); } public void onStatusChanged(String provider, int status, Bundle extras) {} public void onProviderEnabled(String provider) { requestLocations(); } public void onProviderDisabled(String provider) { removeRequestLocation(); } }; trackUserLocation(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dndzgzApp = ((DndZgzApplication) this.getApplication()); if (getIntent().hasExtra("object")) { wifiInfo = getIntent().getStringExtra("object"); } try { wifiJson = new JSONObject(wifiInfo); wifiJson.put("type", "wifi"); dndzgzApp.setLastObject(wifiJson); } catch (JSONException e) { e.printStackTrace(); } // ACTION BAR setContentView(R.layout.data_info); ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar); Intent homeIntent = new Intent(this, MenuActivity.class); homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); actionBar.setHomeAction(new IntentAction(this, homeIntent, R.drawable.ic_title_home_default)); /////////////////////// String uri = ""; try { uri = "google.navigation:q=" + wifiJson.getString("lat") + "," + wifiJson.getString("lon"); } catch (JSONException e1) { e1.printStackTrace(); } Intent RouteIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)); final Action routeAction = new IntentAction(this, RouteIntent, R.drawable.ic_action_bar_navigation); actionBar.addAction(routeAction); Intent FavIntent = new Intent(WifiDataActivity.this, FavoritesActivity.class); FavIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); FavIntent.putExtra("action", "add"); final Action FavAction = new IntentAction(this, FavIntent, R.drawable.ic_action_bar_star); actionBar.addAction(FavAction); try { actionBar.setTitle(wifiJson.getString("title")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } // //////////////// contenedor = (LinearLayout) findViewById(R.id.contenedor); runnableWifi = new Runnable() { @Override public void run() { getInfoWifi(); } }; Thread thread = new Thread(null, runnableWifi, "ObtenerInfoWifi"); thread.start(); m_ProgressDialog = ProgressDialog.show( WifiDataActivity.this, getText(R.string.espere), getText(R.string.obteniendo_datos), true); }