M0286_Libro Curso
4: Web móvil en acción
// Llamada a Servidor Web PHP post = new Post(); JSONArray datos = post.getServerData(parametros, “http://seas-imagemaps.webatu. if (datos != null && datos.length() > 0) { for (int i = 0; i < datos.length(); i++) { JSONObject json_data = datos.
com/login.php”);
getJSONObject(i); getInt(“ID”); getString(“NOMBRE”); getString(“DESCRIPCION”); getString(“LONGITUD”); getString(“LATITUD”); getString(“IMAGEN”); imagemaps.webatu.com/”
int idSitio = json_data. String nombre = json_data. String descripcion = json_data. String longitud = json_data. String latitud = json_data. String img = json_data. String urlImagen = “http://seas-
+ img;
Bitmap
loadedImage
=
downloadFile(urlImagen);
imagenView.setImageBitmap
(loadedImage);
OverlayItem
overlay
=
getOverlayItem(nombre, descripcion,
latitud, longitud,
imagenView.getDrawable());
SeasTuristicLocationZaragoza.
getInstance ()
.anadePuntoAlMapaCon
ItemizedOverlayEImagen(overlay); } } } catch (Exception e) { Toast. makeText ( getInstance ().getBaseContext(),
SeasTuristicLocationZaragoza. e.getMessage(), Toast. LENGTH_
SHORT ).show(); }
} // FIN Llamada a Servidor Web PHP
} Y ya por último, vamos a crear la clase ServiciosTuristicLocation.java . Esta clase será la que nos muestre el mapa con los recursos del servidor y con la posición de nuestra localización actual. Aunque es una clase bastante extensa, vamos a ir poco a poco insertando el código y comentándolo.
279
Made with FlippingBook - Online catalogs