Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 12:22 PM, Raghav Sood raghavs...@gmail.com wrote:

 I am getting an error that I can not compare these values as they are
 Doubles in nature and null is not valid here with ||. How can I compare
 these?


As the error indicates, they are not object that are comparable to null.
They are guaranteed to have *some* value. What are you trying to guard
against?

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
I am trying to guard against them being null. I am getting error reports
from users via ACRA that these are returning null sometimes. Hence the
safeguard.

On Thu, Jul 7, 2011 at 11:05 PM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 12:22 PM, Raghav Sood raghavs...@gmail.com wrote:

 I am getting an error that I can not compare these values as they are
 Doubles in nature and null is not valid here with ||. How can I compare
 these?


 As the error indicates, they are not object that are comparable to null.
 They are guaranteed to have *some* value. What are you trying to guard
 against?


 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 12:38 PM, Raghav Sood raghavs...@gmail.com wrote:

 I am trying to guard against them being null.

I am getting error reports from users via ACRA that these are returning null
 sometimes.


That's not possible. Double-check your logs and what variable they point to.
The Location object may be null, but it's double type variables cannot.

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
TreKing I had this in a previous thread to but that problem was fixed. This
is another one causing the same error/

java.lang.NullPointerException
at com.raghavsood.findme.MyPositionOverlay.draw(MyPositionOverlay.java:37)
at com.google.android.maps.Overlay.draw(Overlay.java:179)
at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:45)
at com.google.android.maps.MapView.onDraw(MapView.java:494)
at android.view.View.draw(View.java:6740)
at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
at android.view.View.draw(View.java:6743)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
at android.view.View.draw(View.java:6743)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1847)
at android.view.ViewRoot.draw(ViewRoot.java:1407)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)

And MyPositionOverlay.java:37 is:

Double latitude = location.getLatitude()*1E6;


It is a NullPointerException so I suppose it is returning null.
On Thu, Jul 7, 2011 at 11:10 PM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 12:38 PM, Raghav Sood raghavs...@gmail.com wrote:

 I am trying to guard against them being null.

 I am getting error reports from users via ACRA that these are returning
 null sometimes.


 That's not possible. Double-check your logs and what variable they point
 to. The Location object may be null, but it's double type variables cannot.


 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Mark Murphy
Your location variable is null.

On Thu, Jul 7, 2011 at 1:45 PM, Raghav Sood raghavs...@gmail.com wrote:
 Double latitude = location.getLatitude()*1E6;

 It is a NullPointerException so I suppose it is returning null.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 12:45 PM, Raghav Sood raghavs...@gmail.com wrote:

 Double latitude = location.getLatitude()*1E6;


 It is a NullPointerException so I suppose it is returning null.


NullPointerExceptions are cause by *objects* that are set to null. The only
*object* in that statement is location. Thus, that's what is null.

You can verify this by using your debugger and breaking at that line.

I'd recommend you brush up on Java and the different between Object types
and Value types to understand the differences between the two.

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
But the thing is location can't be null. If it was the app wouldn't have
reached here. I check for location being null in my main activity:

if (location != null) {

 // Update my location marker

positionOverlay.setLocation(location);


Only the does MyPositionOverlay receive location.


On Thu, Jul 7, 2011 at 11:23 PM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 12:45 PM, Raghav Sood raghavs...@gmail.com wrote:

 Double latitude = location.getLatitude()*1E6;


 It is a NullPointerException so I suppose it is returning null.


 NullPointerExceptions are cause by *objects* that are set to null. The only
 *object* in that statement is location. Thus, that's what is null.

 You can verify this by using your debugger and breaking at that line.

 I'd recommend you brush up on Java and the different between Object types
 and Value types to understand the differences between the two.


 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Mark Murphy
On Thu, Jul 7, 2011 at 2:00 PM, Raghav Sood raghavs...@gmail.com wrote:
 But the thing is location can't be null. If it was the app wouldn't have
 reached here. I check for location being null in my main activity:

 if (location != null) {

          // Update my location marker

         positionOverlay.setLocation(location);

 Only the does MyPositionOverlay receive location.

As I indicated in your previous thread, if you try to use the overlay
and YOU HAVE NOT RECEIVED A LOCATION YET (caps to ensure you pay
attention), your location variable will be null simply because you
haven't ever had any valid Location to use.

So, as I wrote before, you either need to not set up the overlay until
you actually have a Location, or you need to have more smarts in the
overlay to deal with the null location case.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
Okay. Maybe I am missing something here but AFAIK the if statement check to
see that location is not equal to null and if that is true (location not
being null)
it passes it on to the Overlay.

Did I get that right?

On Thu, Jul 7, 2011 at 11:36 PM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 7, 2011 at 2:00 PM, Raghav Sood raghavs...@gmail.com wrote:
  But the thing is location can't be null. If it was the app wouldn't have
  reached here. I check for location being null in my main activity:
 
  if (location != null) {
 
   // Update my location marker
 
  positionOverlay.setLocation(location);
 
  Only the does MyPositionOverlay receive location.

 As I indicated in your previous thread, if you try to use the overlay
 and YOU HAVE NOT RECEIVED A LOCATION YET (caps to ensure you pay
 attention), your location variable will be null simply because you
 haven't ever had any valid Location to use.

 So, as I wrote before, you either need to not set up the overlay until
 you actually have a Location, or you need to have more smarts in the
 overlay to deal with the null location case.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android Training...At Your Office: http://commonsware.com/training

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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 1:00 PM, Raghav Sood raghavs...@gmail.com wrote:

 But the thing is location can't be null.


It can and it is.


 If it was the app wouldn't have reached here.


Correct. But this is not where the crash is.


 I check for location being null in my main activity:

 if (location != null) {

  // Update my location marker

 positionOverlay.setLocation(location);


 Only the does MyPositionOverlay receive location.


Precisely - only there does it receive location - otherwise it remains null
(the default for an object) and you don't check for null in your draw()
call. Thus, unless you set a valid Location object in your main activity,
your internal location will remain null and you will crash and burn as you
have already seen when your position overlay goes to draw.

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 1:11 PM, Raghav Sood raghavs...@gmail.com wrote:

 Okay. Maybe I am missing something here but AFAIK the if statement check to
 see that location is not equal to null and if that is true (location not
 being null)
 it passes it on to the Overlay.

 Did I get that right?


What I do for the user's location on the map is get their location first,
then, when a valid location is obtained, create the marker and add it to the
map.

Sidenote: is there some reason you're not using MyLocationOverlay?

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
Right. Got it now.

Basically I need to check location for null twice. Once in the Activity and
once in the Overlay.

Thanks

On Thu, Jul 7, 2011 at 11:44 PM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 1:00 PM, Raghav Sood raghavs...@gmail.com wrote:

 But the thing is location can't be null.


 It can and it is.


 If it was the app wouldn't have reached here.


 Correct. But this is not where the crash is.


 I check for location being null in my main activity:

 if (location != null) {

  // Update my location marker

 positionOverlay.setLocation(location);


 Only the does MyPositionOverlay receive location.


 Precisely - only there does it receive location - otherwise it remains null
 (the default for an object) and you don't check for null in your draw()
 call. Thus, unless you set a valid Location object in your main activity,
 your internal location will remain null and you will crash and burn as you
 have already seen when your position overlay goes to draw.


 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
I needed a custom graphic and text on the location point and the book I used
said it was not possible with MyLocationOverlay. Also later on I plan on
adding a few more things that would not work with MyLocationOverlay.

Thanks

P.S. If I have a method in my Activity to display a toast can I safely call
it from the Overlay class?

On Thu, Jul 7, 2011 at 11:48 PM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 1:11 PM, Raghav Sood raghavs...@gmail.com wrote:

 Okay. Maybe I am missing something here but AFAIK the if statement check
 to see that location is not equal to null and if that is true (location not
 being null)
 it passes it on to the Overlay.

 Did I get that right?


 What I do for the user's location on the map is get their location first,
 then, when a valid location is obtained, create the marker and add it to the
 map.

 Sidenote: is there some reason you're not using MyLocationOverlay?



 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 1:24 PM, Raghav Sood raghavs...@gmail.com wrote:

 P.S. If I have a method in my Activity to display a toast can I safely call
 it from the Overlay class?


Well, sure, with a valid reference to the Activity. But injecting a
dependency on the Activity into your Overlay to display a toast does not
seem like a great idea.

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 1:24 PM, Raghav Sood raghavs...@gmail.com wrote:

 I needed a custom graphic and text on the location point and the book I
 used said it was not possible with MyLocationOverlay.


I like this book less and less.

MyLocationOverlay is just another Overlay that handles the drawing of a dot,
radius, and getting location updates. If you need custom drawing, then you
can just override the draw() function, call super() to draw the default
location and radius, and then continue doing your own drawing for the text
and graphics.

Meanwhile you get the location update logic for free.

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
I know :(. But I am at a loss as to how to notify my users that there is
something wrong.

On Thu, Jul 7, 2011 at 11:59 PM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 1:24 PM, Raghav Sood raghavs...@gmail.com wrote:

 P.S. If I have a method in my Activity to display a toast can I safely
 call it from the Overlay class?


 Well, sure, with a valid reference to the Activity. But injecting a
 dependency on the Activity into your Overlay to display a toast does not
 seem like a great idea.



 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread TreKing
On Thu, Jul 7, 2011 at 1:33 PM, Raghav Sood raghavs...@gmail.com wrote:

 I know :(. But I am at a loss as to how to notify my users that there is
 something wrong.


Well your overlay has access to the MapView on which it is drawing, which in
turn has a Context, which is all you really need for Toast.makeText().

-
TreKing http://sites.google.com/site/rezmobileapps/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

Re: [android-developers] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
I should probably change it.

Seeing as this book has given me more errors than knowledge I think I'd get
another one. Maybe one of Mark's.

@Mark: Where can I get your book in New Delhi, India? I can't find it at any
of the major stores and I don't have any virtual cash or credit card to buy
it online. (A small downside of being 14.)

On Fri, Jul 8, 2011 at 12:02 AM, TreKing treking...@gmail.com wrote:

 On Thu, Jul 7, 2011 at 1:24 PM, Raghav Sood raghavs...@gmail.com wrote:

 I needed a custom graphic and text on the location point and the book I
 used said it was not possible with MyLocationOverlay.


 I like this book less and less.

 MyLocationOverlay is just another Overlay that handles the drawing of a
 dot, radius, and getting location updates. If you need custom drawing, then
 you can just override the draw() function, call super() to draw the default
 location and radius, and then continue doing your own drawing for the text
 and graphics.

 Meanwhile you get the location update logic for free.


 -
 TreKing http://sites.google.com/site/rezmobileapps/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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Kostya Vasilyev
You can use a status bar notification, or implement some sort of 
callback (listener) that takes you back to the activity, where you can 
e.g. display a dialog:


myObject.setErrorListener(new ErrorListener() {
@Override
public void somethingBadHappened( ) {
// display a dialog, a toast, or call activity.finish() :)
}
};

-- Kostya

07.07.2011 22:33, Raghav Sood ?:
I know :(. But I am at a loss as to how to notify my users that there 
is something wrong.


On Thu, Jul 7, 2011 at 11:59 PM, TreKing treking...@gmail.com 
mailto:treking...@gmail.com wrote:


On Thu, Jul 7, 2011 at 1:24 PM, Raghav Sood raghavs...@gmail.com
mailto:raghavs...@gmail.com wrote:

P.S. If I have a method in my Activity to display a toast can
I safely call it from the Overlay class?


Well, sure, with a valid reference to the Activity. But injecting
a dependency on the Activity into your Overlay to display a toast
does not seem like a great idea.



--
Kostya Vasilyev

--
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
I think I'll go with Status Bar notification. I might add a form later
asking them whether or not they have a SIM card and ship it as a custom
variable with ACRA. (Only reason I can think of for the null value is a
missing SIM card as I use the cell network for location.)

And before someone tells me that ACRA supports user dialogues. I tried
getting them to work but it didn't show up.

On Fri, Jul 8, 2011 at 12:09 AM, Kostya Vasilyev kmans...@gmail.com wrote:

 **
 You can use a status bar notification, or implement some sort of callback
 (listener) that takes you back to the activity, where you can e.g. display a
 dialog:

 myObject.setErrorListener(new ErrorListener() {
 @Override
 public void somethingBadHappened( ) {
 // display a dialog, a toast, or call activity.finish() :)
 }
 };

 -- Kostya

 07.07.2011 22:33, Raghav Sood пишет:

 I know :(. But I am at a loss as to how to notify my users that there is
 something wrong.

 On Thu, Jul 7, 2011 at 11:59 PM, TreKing treking...@gmail.com wrote:

  On Thu, Jul 7, 2011 at 1:24 PM, Raghav Sood raghavs...@gmail.comwrote:

 P.S. If I have a method in my Activity to display a toast can I safely
 call it from the Overlay class?


  Well, sure, with a valid reference to the Activity. But injecting a
 dependency on the Activity into your Overlay to display a toast does not
 seem like a great idea.


 --
 Kostya Vasilyev

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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Mark Murphy
On Thu, Jul 7, 2011 at 2:38 PM, Raghav Sood raghavs...@gmail.com wrote:
 @Mark: Where can I get your book in New Delhi, India? I can't find it at any
 of the major stores and I don't have any virtual cash or credit card to buy
 it online. (A small downside of being 14.)

You're 14?

I take back anything I ever said bad about you... :-)

The books that CommonsWare publishes are not available in physical
bookstores. You could pick up one of the _Beginning Android_ series
from Apress, which are editions of _The Busy Coder's Guide to Android
Development_ under a different title.

But, for that, you may as well grab the free older editions off of my
Web site -- they're about the same age as the print one and have the
added advantage of being free.

Just visit http://commonsware.com, click on any of the books, and tap
on the Four-to-Free Guarantee tab mid-way down the page. There are
several free editions of each of my books; just grab the highest
version # one.

In fact, I have another batch of those that I need to process and
upload later today.

BTW, don't forget to sleep!

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Raghav Sood
Thanks Mark. I really appreciate all the help all of you have given me so
far. I got your books and they are a lot more straightforward than the one I
was using so far.

I won't forget to sleep. In fact I am going to do it now. It is about 00:30
here in India.

Thanks a lot for your help.

On Fri, Jul 8, 2011 at 12:17 AM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 7, 2011 at 2:38 PM, Raghav Sood raghavs...@gmail.com wrote:
  @Mark: Where can I get your book in New Delhi, India? I can't find it at
 any
  of the major stores and I don't have any virtual cash or credit card to
 buy
  it online. (A small downside of being 14.)

 You're 14?

 I take back anything I ever said bad about you... :-)

 The books that CommonsWare publishes are not available in physical
 bookstores. You could pick up one of the _Beginning Android_ series
 from Apress, which are editions of _The Busy Coder's Guide to Android
 Development_ under a different title.

 But, for that, you may as well grab the free older editions off of my
 Web site -- they're about the same age as the print one and have the
 added advantage of being free.

 Just visit http://commonsware.com, click on any of the books, and tap
 on the Four-to-Free Guarantee tab mid-way down the page. There are
 several free editions of each of my books; just grab the highest
 version # one.

 In fact, I have another batch of those that I need to process and
 upload later today.

 BTW, don't forget to sleep!

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 Android Training...At Your Office: http://commonsware.com/training

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




-- 
Raghav Sood
http://www.raghavsood.com/
http://wiki.androidappcheck.com/
http://www.telstop.tel/
https://market.android.com/developer?pub=Raghav+Sood

-- 
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] Comparing getLatitude() and getLongitude() to null

2011-07-07 Thread Mark Murphy
On Thu, Jul 7, 2011 at 3:09 PM, Raghav Sood raghavs...@gmail.com wrote:
 Thanks Mark. I really appreciate all the help all of you have given me so
 far. I got your books and they are a lot more straightforward than the one I
 was using so far.

BTW, I just uploaded a new round of editions, so you may want to check
and ensure you got the latest ones.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

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