Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 1.68 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to read line to line when my txt is in the raw folder?
  2. 38.706937,-0.494406,Alcoy,Alcoy,Comunidad Valenciana
  3. 37.605651,-0.991294,Vuelo1,Cartagena,Región de Murcia
  4. 37.652022,-0.719147,Vuelo2,La Manga del Mar Menor,Región de Murcia
  5. 42.817988,-1.644183,Vuelo3,Pamplona,Navarra
  6. 36.750779,-5.812395,Vuelo4,Arcos de la frontera,Andalucia
  7.        
  8. private void leerPuntosApp(){
  9.     InputStream stream =getResources().openRawResource(R.raw.sitios);
  10.     BufferedReader brin = new BufferedReader(new InputStreamReader(stream));
  11.     String todoPartes = null;
  12.  
  13.     try {
  14.         while(brin.read() != -1){
  15.             todoPartes = brin.readLine();
  16.             dibujarPuntos(todoPartes);
  17.         }
  18.     } catch (IOException e) {
  19.         e.printStackTrace();
  20.     }
  21. }
  22.  
  23. private void dibujarPuntos(String punto){
  24.     Toast.makeText(this, punto, Toast.LENGTH_SHORT).show();
  25.     String []separados = punto.split(",");
  26.  
  27.         Dialog dialog = hacerDialogo(separados[0],separados[1],
  28.                   separados[2],separados[3],separados[4]);
  29.  
  30.         itemOverlay = new CargarItem(puntosMapa,this,dialog);
  31.  
  32.         lat = Double.parseDouble(separados[0])*1E6;
  33.         lon = Double.parseDouble(separados[1])*1E6;
  34.  
  35.         GeoPoint point = new GeoPoint(lat.intValue(),lon.intValue());
  36.         //GeoPoint point = calcularCoordenadas(listaDeSitios.get(i).getCiudad());
  37.  
  38.         item = new OverlayItem(point,separados[2], null);
  39.         itemOverlay.addOverlay(item);
  40.         mapOverlays.add(itemOverlay);
  41.         mapView.postInvalidate();
  42.  
  43. }
  44.        
  45. try {
  46.     while((todoPartes = brin.readLine()) != null){
  47.         dibujarPuntos(todoPartes);
  48.     }
  49. } catch (IOException e) {
  50.     e.printStackTrace();
  51. }
  52.        
  53. lat = Double.parseDouble(separados[0])*1E6;