Trying to load a list of overlay positions from file?
<p><strong>SOLVED:</strong> I had the longitude and latitude in the file backwards</p>

<p>Hi, I am trying to develop an app to list the bus stops for my local Public Transit buses on a google map map, 
but i seem to be having problem loading the overlay markers locations from a text file</p>

<p>Heres the code i use to load a new overlay onto the mapview:</p>

<pre><code>public void AddOverlayItem(int intLat, int intLong, String strStop,String strType) {
     Toast.makeText(HelloGoogleMaps.this.getBaseContext(), intLat + "," + intLong + "," + strStop + "," + strType,Toast.LENGTH_SHORT).show();
    // TODO Auto-generated method stub
     List&lt;Overlay&gt; mapOverlays = mapView.getOverlays();
     Drawable drawable = this.getResources().getDrawable(R.drawable.viva);

     if ("YRT".equals(strType)) {
         drawable = this.getResources().getDrawable(R.drawable.yrt);
     }

     HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this);

     GeoPoint point = new GeoPoint(intLat,intLong);
     OverlayItem overlayitem = new OverlayItem(point, strStop, strType);

     itemizedoverlay.addOverlay(overlayitem);

     mapOverlays.add(itemizedoverlay);


}
</code></pre>

<p>When i call the above code from a button i click from within my app all works fine, settings get saved and marker appears on screen:</p>

<pre><code>WriteSettings(HelloGoogleMaps.this,String.valueOf((int)(longitude*1E6)) + "&lt;&gt;" + 
                        String.valueOf((int)(latitude*1E6)) + "&lt;&gt;" +
                                  etStop.getText().toString() + "&lt;&gt;" + "YRT");

AddOverlayItem((int)(latitude*1E6),(int)(longitude*1E6),
                            etStop.getText().toString(),"YRT");
</code></pre>

<p>But the problem i am having is when i call the following code at the end of the onCreate method, my overlays do not appear:</p>

<pre><code>public void RefreshStops() {
    // Refreshes the list of bus stop's
    //Find the directory for the SD Card using the API
    //*Don't* hardcode "/sdcard"
    File sdcard = Environment.getExternalStorageDirectory();

    //Get the text file
    File file = new File(sdcard,LocFile);

    try {
        BufferedReader br = new BufferedReader(new FileReader(file));
        String line;

        while ((line = br.readLine()) != null) {
            String LineSplit[] = line.split("&lt;&gt;");
            AddOverlayItem(Integer.parseInt(LineSplit[0]),Integer.parseInt(LineSplit[1]),LineSplit[2], LineSplit[3]); 
        }
    }
    catch (IOException e) {
        //You'll need to add proper error handling here
        Toast.makeText(HelloGoogleMaps.this.getBaseContext(),e.getMessage(),Toast.LENGTH_SHORT).show();
    }


}
</code></pre>

<p>Contents of file being read: 
longitude&lt;>latitude&lt;>stopnumber&lt;>bus-service</p>

<pre><code>cat BusLoc2.txt
-79261518&lt;&gt;44006280&lt;&gt;2511&lt;&gt;YRT
-79161518&lt;&gt;44006280&lt;&gt;3243&lt;&gt;YRT
-79161518&lt;&gt;44006280&lt;&gt;6465&lt;&gt;YRT
-79161518&lt;&gt;44006280&lt;&gt;675&lt;&gt;YRT
</code></pre>

<p>I know the AddOverlayItem() method is being called from the RefreshStops() method because i have put a 'toast' in the AddOverlayItem() method for debug purposes and can see the info being passed to it correctly but for some reason they are not appearing??????</p>

<p>Any one have any idea why my markers are not being added? 
Thanks for any help</p>
