Question
Hello, I currently have this problem in Java. I have an android program reading a csv file. I need to read the file where I
Hello, I currently have this problem in Java. I have an android program reading a csv file. I need to read the file where I can do it like the answer here: http://stackoverflow.com/questions/19508482/display-title-of-closest-marker-from-my-current-position-google-maps-v2. How can I implement it in my android program?
Here is the CSV File:
Here is my current code:
//Current Lat Long for zoom in and current location double myLat = myLocation.getLatitude(); double myLong = myLocation.getLongitude(); /* * * * * * * KEEP THIS UNTIL DB IS MADE * * * * * * * * * */ //Crosswalk Lat and Long List crosswalkLatLngList = new ArrayList(); String cwData = ""; InputStream crosswalkIS; // Current Location in Library and move the camera LatLng myLatLng = new LatLng(myLat,myLong); /* * * * * * * KEEP THIS UNTIL DB IS MADE * * * * * * * * * */ //Gets the latitude and longitude of the crosswalks from native CSV File crosswalkIS=getResources().openRawResource(R.raw.crosswalk); BufferedReader reader = new BufferedReader(new InputStreamReader(crosswalkIS)); try { while((cwData = reader.readLine()) !=null){ try{ double lat = Double.parseDouble(cwData.split(",")[0]); double lon = Double.parseDouble(cwData.split(",")[1]); crosswalkLatLngList.add(new LatLng(lat, lon)); }catch(Exception e){ Log.e("Unknown", e.toString()); } } } catch (IOException e) { throw new RuntimeException("Error: Cannot Read CSV File"+e); } for(LatLng pos : crosswalkLatLngList) { mMap.addMarker(new MarkerOptions() .position(pos)); }
It needs to be implemented like the answer here: http://stackoverflow.com/questions/19508482/display-title-of-closest-marker-from-my-current-position-google-maps-v2
I couldn't implement it in such a way like the stack overflow
Thanks!
30.268177,-81.50973 30.268340, -81.508869 30.271002, -81.510978 30.26648, 1.511 008 30.266496, 1.511 038 30.266459,-81.511029 30.266345 1.511174 30.272975, -81.509220 30.272938, -81.508780 30.270685, -81.505933 30.266089, -81.504488 30.264116, -81.505699 30.264123, -81.505626 30.262422 81.503170 30.262369 -81.503179 30.268177,-81.50973 30.268340, -81.508869 30.271002, -81.510978 30.26648, 1.511 008 30.266496, 1.511 038 30.266459,-81.511029 30.266345 1.511174 30.272975, -81.509220 30.272938, -81.508780 30.270685, -81.505933 30.266089, -81.504488 30.264116, -81.505699 30.264123, -81.505626 30.262422 81.503170 30.262369 -81.503179Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started