Re: [android-developers] Trying to load a list of overlay positions from file

2011-04-17 Thread lbendlin
Let's say you want to compare two bus lines for duration, or location of 
stops. This means you would need to be able to individually switch bus line 
display on and off on your map.  That's what overlays are for.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Trying to load a list of overlay positions from file

2011-04-17 Thread matt h
what do you mean one overlay per bus line?
what my app is doing is it lists all bus stops in my area, then when i tap a
marker it will open the web browser and display the times the bus comes at
for that stop.
Eventually I will parse the web page and display the times within the dialog
that pops up when the marker is clicked.

On Fri, Apr 15, 2011 at 9:04 PM, lbendlin  wrote:

> Why are you creating a new overlay for each marker? To stay with your
> story, one overlay per bus line would make much more sense.
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Trying to load a list of overlay positions from file

2011-04-17 Thread matt h
**facepalm** yeh i had my lat and longitude mixed up, thanks

On Fri, Apr 15, 2011 at 8:16 PM, TreKing  wrote:

> On Thu, Apr 14, 2011 at 2:49 PM, matt h  wrote:
>
>> Hi, I am trying to develop an app to list the bus stops for my local
>> Public Transit buses on a google map map,
>>
>
> It's not Chicago is it!? =P
>
>
>> Any one have any idea why my markers are not being added?
>>
>
> Tip: when stuff doesn't show on the map, try zooming all the way out in
> case you've plotted it wrong 
>
> Walk with me here ...
>
> This is your format, right?:-79261518<>44006280<>2511<>YRT
> And this is your parsing, right?: LineSplit[0]),Integer.parseInt(LineSplit[1])
> ...
> And this is your function, right?: AddOverlayItem(int intLat, int intLong
> ...
> So -79261518 is latitude, 44006280 is the longitude right?
> And this becomes -79.261518 and 44.006280, right?
>
> Is this a transit system for 
> Penguins
> ?
> Or for 
> Ducks
> ?
>
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Trying to load a list of overlay positions from file

2011-04-15 Thread lbendlin
Why are you creating a new overlay for each marker? To stay with your story, 
one overlay per bus line would make much more sense.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Trying to load a list of overlay positions from file

2011-04-15 Thread TreKing
On Thu, Apr 14, 2011 at 2:49 PM, matt h  wrote:

> Hi, I am trying to develop an app to list the bus stops for my local Public
> Transit buses on a google map map,
>

It's not Chicago is it!? =P


> Any one have any idea why my markers are not being added?
>

Tip: when stuff doesn't show on the map, try zooming all the way out in case
you've plotted it wrong 

Walk with me here ...

This is your format, right?:-79261518<>44006280<>2511<>YRT
And this is your parsing, right?: LineSplit[0]),Integer.parseInt(LineSplit[1])
...
And this is your function, right?: AddOverlayItem(int intLat, int intLong
...
So -79261518 is latitude, 44006280 is the longitude right?
And this becomes -79.261518 and 44.006280, right?

Is this a transit system for
Penguins
?
Or for 
Ducks
?

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Trying to load a list of overlay positions from file

2011-04-15 Thread matt h
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

Heres the code i use to load a new overlay onto the mapview:


[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 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]


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:

[CODE]
WriteSettings(HelloGoogleMaps.this,String.valueOf((int)(longitude*1E6))
+ "<>" +
 String.valueOf((int)(latitude*1E6)) + "<>" +
  etStop.getText().toString() + "<>" +
"YRT");

AddOverlayItem((int)(latitude*1E6),(int)(longitude*1E6),
etStop.getText().toString(),"YRT");
[/CODE]

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:

[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("<>");
 
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]

Contents of file being read:
longitude<>latitude<>stopnumber<>bus-service

[CODE]
cat BusLoc2.txt
-79261518<>44006280<>2511<>YRT
-79161518<>44006280<>3243<>YRT
-79161518<>44006280<>6465<>YRT
-79161518<>44006280<>675<>YRT
[/CODE]

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??

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

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en