- How to read line to line when my txt is in the raw folder?
- 38.706937,-0.494406,Alcoy,Alcoy,Comunidad Valenciana
- 37.605651,-0.991294,Vuelo1,Cartagena,Región de Murcia
- 37.652022,-0.719147,Vuelo2,La Manga del Mar Menor,Región de Murcia
- 42.817988,-1.644183,Vuelo3,Pamplona,Navarra
- 36.750779,-5.812395,Vuelo4,Arcos de la frontera,Andalucia
- private void leerPuntosApp(){
- InputStream stream =getResources().openRawResource(R.raw.sitios);
- BufferedReader brin = new BufferedReader(new InputStreamReader(stream));
- String todoPartes = null;
- try {
- while(brin.read() != -1){
- todoPartes = brin.readLine();
- dibujarPuntos(todoPartes);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- private void dibujarPuntos(String punto){
- Toast.makeText(this, punto, Toast.LENGTH_SHORT).show();
- String []separados = punto.split(",");
- Dialog dialog = hacerDialogo(separados[0],separados[1],
- separados[2],separados[3],separados[4]);
- itemOverlay = new CargarItem(puntosMapa,this,dialog);
- lat = Double.parseDouble(separados[0])*1E6;
- lon = Double.parseDouble(separados[1])*1E6;
- GeoPoint point = new GeoPoint(lat.intValue(),lon.intValue());
- //GeoPoint point = calcularCoordenadas(listaDeSitios.get(i).getCiudad());
- item = new OverlayItem(point,separados[2], null);
- itemOverlay.addOverlay(item);
- mapOverlays.add(itemOverlay);
- mapView.postInvalidate();
- }
- try {
- while((todoPartes = brin.readLine()) != null){
- dibujarPuntos(todoPartes);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- lat = Double.parseDouble(separados[0])*1E6;