[android-developers] Re: GPS accuracy reliability

2010-07-14 Thread jgostylo
drpickett:
When I say I demand a certain accuracy from the GPS what I mean is
that when it reports a location I call getAccuracy and if it is not
good enough I throw away the result.  Maybe I should just be more
lenient on the accuracy from a network location.

All of this and people have only sort of answered my question.  I
understand that the answer may just be I don't really know what it
would do and I understand that really isn't an answer people post on
the forum because it does not fill the information gap.  The accuracy
is a function of the number of satellites in view and other stuff.  I
get that.  But the question remains the same.  When it tells me my
location is hundreds of miles from where I actually am, will the call
to getAccuracy return hundreds of thousands of meters?


PsuedoCode for the previous request (may be missing and spotty but you
get the gist):

public class ContainerClass extends Activity

  onCreate(Bundle savedInstanceState)
  {
...
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Criteria myCriteria = new Criteria();
myCriteria.setAccuracy(Criteria.ACCURACY_FINE);

providerList = lm.getProviders(true);

for (String provider : providerList)
{
  if (provider.equals(LocationManager.GPS_PROVIDER))
  {
lm.requestLocationUpdates(provider, 7000, 20, gpsLocationListener);
  }
  else if (provider.equals(LocationManager.NETWORK_PROVIDER))
  {
lm.requestLocationUpdates(provider, 7000, 20,
networkLocationListener);
  }
}
  }

// Wireless location listener
private final LocationListener networkLocationListener = new
LocationListener() {
  public void onLocationChanged(Location location) {

ContainerClass.this.gpsLocationListener.onLocationChanged(location);
  }

  public void onProviderDisabled(String provider){}
  public void onProviderEnabled(String provider) {}
  public void onStatusChanged(String provider, int status, Bundle
extras) {}
};

// GPS location listener
private final LocationListener gpsLocationListener = new
LocationListener() {
  public void onLocationChanged(Location location) {

   //location.getProvider() will return which provider
supplied this location

//Logic when a location is found

   if ((long)Math.floor(SystemClock.elapsedRealtime()/1000) -
locationTimeElapse  7)
   {
locationTimeElapse =
(long)Math.floor(SystemClock.elapsedRealtime()/1000);
currentLocationAccuracy += 10;
if (locationAccuracy  1500f)
{
currentLocationAccuracy = 1500f;
}
   }

   if (location.getAccuracy()  30.0 || location.getAccuracy() =
currentLocationAccuracy)
   {
currentLocationAccuracy = location.getAccuracy();
//and other junk happens
   }

 }

  public void onProviderDisabled(String provider){}
  public void onProviderEnabled(String provider) {}
  public void onStatusChanged(String provider, int status, Bundle
extras) {}
};

On Jul 10, 9:13 pm, drpickett davidrpick...@gmail.com wrote:
  Maybe I
  can be choosy and say that if it GPS then I demand 20 meter accuracy
  but if it is network then I only demand 500 meter???

 Chuck Norris can demand a certain accuracy from GPS - You can't -
 GPS reports its accuracy to you - It is a function of the number of
 satellites in view, and other stuff

 dp

-- 
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] Re: GPS accuracy reliability

2010-07-10 Thread jgostylo
In answer to some questions.  I am setting up the network location
finder and the GPS location finder using 2 separate
LocationListeners.  I have some logic that determines what the user
has activated so I only listen to gps if the have gps enabled and so
forth.

From my user feedback it seems like the biggest location discrepancies
happen with GPS.  I have not been able to personally verify this.  I
don't need to be super picky about how accurate it is (500 meters
would suffice).  I am just wondering if GPS is putting people several
hundred miles away from their actual location is it also reliable to
say that its accuracy is over 200,000 meters?  That way I can throw
out anything that says it is less accurate than 500 meters.

If it is putting my user 200 miles away and saying that it thinks its
accuracy is within 100 meter then it really does me no good.  Maybe I
can be choosy and say that if it GPS then I demand 20 meter accuracy
but if it is network then I only demand 500 meter???

Thanks for the responses.

On Jul 10, 10:19 am, Maps.Huge.Info (Maps API Guru)
cor...@gmail.com wrote:
 You can manage the orientation changes yourself and eliminate this
 source of device confusion, it's quite easy, just add
 android:configChanges=orientation to your manifest's activity.

 As for the signal source, just make sure to check your provider for
 gps - if it says gps, it will be from that source.

 -John Coryat

-- 
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] GPS accuracy reliability

2010-07-09 Thread jgostylo
This is a general question about GPS accuracy reporting based on
feedback from my user community.

My app has an issue where many players get bounced all over kingdom
come when using GPS to get a signal.  I had this issue with my G1 on
occasion but not on my Nexus One.  I am talking hundreds of miles from
their real location.  I changed the code to throw out anything that
was not at least 500 meters accurate.  My question is, if the location
placement is hundreds of miles off, how reliable will the accuracy
reporting be?  Does it realize that it could be hundreds of miles off?

I am asking the community because I cannot reproduce the scenario with
what I currently have so I can't test if my fix is meaningful.  Does
GPS know when its readings are that far off?

-- 
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] determining if phone is rooted

2010-06-04 Thread jgostylo
I have an Android game where location is very important to the rules.
There have been a bunch of cheaters and I have spent a long time
closing off the ways that they exploit the system to cheat.  One way
they have been cheating is using a location spoofing app.  I tried
shutting that off by seeing if Allow mock locations is set to true
and if it is I won't let the game run.

After some research I see that rooted phones can run the location
spoofing app without having to set allow mock locations.  I want to be
able to determine if the phone is rooted so I can add extra checks to
make sure that they are not spoofing their location.  The only
suggestion I have seen to do this is to check to see if /system/bin/su
exists.  I don't think this is a reliable way to do this but it is all
I have so far.

Can anyone suggest any other ways to determine if the phone is a
rooted phone?

-- 
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] Table being pushed outside window

2010-05-24 Thread jgostylo
The issue is that the table I am making extends itself off the right
side of the dialog window.

It seems like it only does this when one of the components in the
table is a textview with enough text to cover multiple lines.

Someone suggested that I try using a gridview instead of a table
layout but everything seems so similar between the two and I don't see
why mine does not work.

The gist of the xml is that I am setting up tables inside my vertical
linearlayout that is going in a dialog window.  The tables are set up
with wrap_content for height and fill_parent for width.  Each table is
one row and the row has a button and a textview.  I want the textview
to stretch to take whatever space the button does not take.  When the
button comes first the textview goes beyond the right edge of the
screen.  When the textview comes first it takes the entire screen
width and pushes the button off the screen.  It seems like the
tablelayout believes its parent is wider than it actually is.

Can someone tell me what I am doing wrong?

Here is the XML:

?xml version=1.0 encoding=utf-8?
LinearLayout
xmlns:android=http://schemas.android.com/apk/res/android;
android:orientation=vertical
android:layout_height=wrap_content
android:layout_width=fill_parent

!-- TABLE WHERE THE TEXTVIEW COMES FIRST --
TableLayout
android:id=@+id/parcelinfo_moveout_table
android:layout_height=wrap_content
android:layout_width=fill_parent
android:layout_gravity=center
android:stretchColumns=0

TableRow
TextView
android:id=@+id/moveout_army
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textSize=14sp
android:text=@string/moveout_text
/
Button
android:id=@+id/moveout_button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_marginTop=5dip
android:text=@string/moveout_button
/
/TableRow
/TableLayout
!-- TABLE WHERE THE BUTTON COMES FIRST --
TableLayout
android:id=@+id/parcelinfo_movein_table
android:layout_height=wrap_content
android:layout_width=fill_parent
android:layout_gravity=center
android:stretchColumns=1

TableRow
Button
android:id=@+id/movein_button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_marginTop=5dip
android:text=@string/movein_button
/
TextView
android:id=@+id/movein_army
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textSize=14sp
android:text=@string/movein_text
/
/TableRow
/TableLayout
TextView
android:id=@+id/notpresent_content
android:layout_width=wrap_content
android:layout_height=wrap_content
android:textColor=@color/text_red
android:layout_marginTop=15dip
android:text=@string/parcelinfo_notpresent
/
TableLayout
android:id=@+id/parcelinfo_buttontable
android:layout_height=wrap_content
android:layout_width=wrap_content
android:layout_gravity=center
android:stretchColumns=*

TableRow
Button
android:id=@+id/parcelinfo_attack_button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_marginTop=5dip
android:text=@string/attack
/
Button
android:id=@+id/parcelinfo_close_button
android:layout_width=wrap_content
android:layout_height=wrap_content
android:layout_marginTop=5dip
android:text=@string/close
/
/TableRow
/TableLayout
/LinearLayout

-- 
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] Changing Launch activity seems to not work on Update

2010-04-26 Thread jgostylo
For a new update I am changing the start-up workflow for the
application.  Part of this is setting the
android.intent.category.LAUNCHER from one activity to another in my
manifest.

When I run an update from what is on the market to what I download
from my website the application starts in the Activity where it used
to start before the update.  When I uninstall the application and
install it from the same package I got from my website it starts in
the Activity where I have now specified it to start.  Shorter version:
Update fails to update launching activity, uninstall-reinstall does
update the launching activity.

Is this a known issue?  Do I really need to add logic to correct for
people who update the app instead of installing fresh?  Asking people
to uninstall for an update is not a viable option.  Is there something
I can do to clean out whatever is getting saved that is causing the
app to launch with the incorrect Activity?

-- 
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] Re: Changing Launch activity seems to not work on Update

2010-04-26 Thread jgostylo
This is on a Samsung Moment running 1.5.

I have verified that my Nexus One running 2.1 update 1 does not
produce this issue.  One other person that tested this out for me was
also having this issue and they were on an HTC Hero.

Maybe this is a 1.5 issue?

Jake

On Apr 26, 11:28 am, Mark Murphy mmur...@commonsware.com wrote:
 jgostylo wrote:
  For a new update I am changing the start-up workflow for the
  application.  Part of this is setting the
  android.intent.category.LAUNCHER from one activity to another in my
  manifest.

  When I run an update from what is on the market to what I download
  from my website the application starts in the Activity where it used
  to start before the update.  When I uninstall the application and
  install it from the same package I got from my website it starts in
  the Activity where I have now specified it to start.  Shorter version:
  Update fails to update launching activity, uninstall-reinstall does
  update the launching activity.

  Is this a known issue?  Do I really need to add logic to correct for
  people who update the app instead of installing fresh?  Asking people
  to uninstall for an update is not a viable option.  Is there something
  I can do to clean out whatever is getting saved that is causing the
  app to launch with the incorrect Activity?

 Which device are you testing this on?

 I seem to recall some HTC Heros having a problem similar to this one,
 several months ago.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|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 
 athttp://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


[android-developers] Looking for definitive location finding logic

2010-03-31 Thread jgostylo
I am looking for a tutorial that explains the logic for fast, robust
location finding.

Basically I am sick of Google Maps finding my location so incredibly
fast and accurately while my own application struggles to get a
location.

I would be fine with pseudo code responses and I will explain what I
am doing so maybe I can be shown what I am doing wrong.

1. Get the locationManager object.
2. Do a 'get best provider' call.
3. Get a list of all available providers.
4. lm.requestLocationUpdates(bestProvider, 0, 0, this);   // hit the
location provider as much as I can to get my first signal
5. Send a delayed message.  If a location cannot be found in 10
seconds, switch to a different provider and try again with
lm.requestLocationUpdates(nextProvider, 0, 0, this);
6. Repeat step 5 until I have a location.
7. Once a location is found determine if it is the most accurate
provider.  If it is not try again with the most accurate provider on
an 8 second delay.  If it is the most accurate provider then set
lm.requestLocationUpdates(currentProvider, 3, 0, this); to
conserve battery
8. Make sure to lm.removeUpdates(this); before changing the
requestLocationUpdates

Now it occurs to me that it may be possible to iterate through my list
of providers and do requestLocationUpdates for all providers at once.
Is this a viable option or can you only listen to one provider at a
time?  I have seen that location from onLocationChanged has
getProvider() to let you know who provided the location information so
that I can know which provider is actually finding a signal and turn
off the others.

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

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: Looking for definitive location finding logic

2010-03-31 Thread jgostylo
Sorry, one last thing.  Getting an incorrect location is just as bad a
not getting a location for me.  That is why I am not currently
considering getLastKnownLocation.  If I am mistaken about the
usefulness of getLastKnownLocation that would also be helpful.

If the user was on the North side of town when the last location was
given to him and he travels to the South part of town and starts the
app I do not want the app to tell him he is on the North side of town
while the app is waiting 30-40 seconds to get a location.

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

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: Looking for definitive location finding logic

2010-03-31 Thread jgostylo
Thank you for the reply.  You say to use unique LocationListener
objects.  Is this because a single LocationListener is not set up to
handle multiple requestLocationUpdates or is there some other gotcha
that you are steering me from?

Jake

On Mar 31, 8:42 am, Mark Murphy mmur...@commonsware.com wrote:
 jgostylo wrote:
  Now it occurs to me that it may be possible to iterate through my list
  of providers and do requestLocationUpdates for all providers at once.
  Is this a viable option or can you only listen to one provider at a
  time?

 AFAIK it is a viable option, but:

 -- Use unique LocationListener objects not one single one

 -- Be sure to call removeLocationUpdates() for all of those
 LocationListener objects

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

 Android Consulting:http://commonsware.com/consulting

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

To unsubscribe, reply using remove me as the subject.


[android-developers] Activity restart crash after OS kills it

2010-03-08 Thread jgostylo
This is what I am doing:

Activity SplashScreen is the launching activity for my app.  It sends
a request to my server and gets back a user data it then uses to
populate a user object which is a static object.  Once it has that it
calls the MyMapView activity and finishes itself.

A force close occurs when I hit the home button and then open up
enough other apps so that Android kills MyMapView to get more
resources.  Now when I open my app again it tries to start MyMapView
and bypasses SplashScreen.  There is no user object so I get null
pointer exceptions.

I have tried to Override the onSaveInstanceState and
OnRestoreInstanceState but it seems that those are not available when
Android kills the activity.

I also tried android:finishOnTaskLaunch with the SplashScreen (maybe
this should be put on MyMapView but the article I read said different)
and that seems to have no effect.

What I would like is for the activity to not restart after Android has
killed it.  What can I do about this?

Thanks,
Jake

-- 
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] Re: Activity restart crash after OS kills it

2010-03-08 Thread jgostylo
Thank you for your reply.  I have stepped through the code and have
seen what you are talking about.  It calls onSaveInstanceState and
saves the data in the Bundle.  Will this Bundle information be
available when the activity restarts after the OS kills the process?
I guess I did not check to see if the Bundle had that kind of
information when the app returned.

Jake

On Mar 8, 12:24 pm, Mark Murphy mmur...@commonsware.com wrote:
 jgostylo wrote:
  This is what I am doing:

  Activity SplashScreen is the launching activity for my app.  It sends
  a request to my server and gets back a user data it then uses to
  populate a user object which is a static object.  Once it has that it
  calls the MyMapView activity and finishes itself.

  A force close occurs when I hit the home button and then open up
  enough other apps so that Android kills MyMapView to get more
  resources.  Now when I open my app again it tries to start MyMapView
  and bypasses SplashScreen.  There is no user object so I get null
  pointer exceptions.

  I have tried to Override the onSaveInstanceState and
  OnRestoreInstanceState but it seems that those are not available when
  Android kills the activity.

 No, but onSaveInstanceState() will be called in and around the onPause()
 and onStop() calls, so they most definitely will have been called by the
 time your process is terminated, given your above scenario.

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

 _The Busy Coder's Guide to Android Development_ Version 3.0
 Available!

-- 
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] Re: Memory Leak in my map overlay

2010-01-11 Thread jgostylo
I have done some additional investigation and it seems that many
people are having similar symptoms but their fixes aren't working for
me.  One person said they had threads that were not dying but I have
checked that my thread count does not continually increase.

I have been using ExecutorService as set up with
Executors.newSingleThreadExecutor(); to run my server requests.  I
also changed it to just run the handler as a normal thread to see if
that would help out.

I have several other Handlers running as ExecutorService in other
activities as well as some processes running as a normal thread that
uses newBM = BitmapFactory.decodeStream(bis); and those do not produce
the memory leak.

The issue seems to be narrowing down to the map overlays.  Can someone
tell me how to accurately destroy an overlay because it seems like
they are hanging around (though how to detect them I am not sure).

On Jan 10, 8:21 am, jgostylo jgost...@gmail.com wrote:
 I have been banging away at this one for weeks and I feel like I have
 exhausted my research capabilities.  I am hoping that someone will see
 my error in the code posted below.  The code is completely functional
 doing everything I need, but there is a major memory leak.

 When I try to track memory in the DDMS, the VM Heap tells me that my
 object count is relatively stable and the used memory is also
 relatively stable (it comes back down to a similar value after each GC
 after panning).  When I look at the memory pie chart, the free memory
 loses over 1meg of capacity with each map pan (overlay reload) and the
 Unknown memory grows.  I have not found anything with the allocation
 tracker.

 Functional Summary:
 I load overlays onto a map based on data I get from polling my
 server.  When I pan the map far enough I clear the overlays and load
 new ones.

 MapFrontEnd.java  (snippets):
 //header info
 private ListOverlay overlays;

 //in onCreate
 overlays = mapView.getOverlays();
 ...
 // here I attempt to fully clean up my old Overlays
 for (Overlay i : overlays)
 {
      if (i instanceof ParcelOverlay)
          ((ParcelOverlay) i).cleanUp();}

 overlays.clear();

 // and now I create the new overlays and add them to the Overlay list
 int count = 0;
 while (count  parcelData.length)
 {
         try
         {
                 overlays.add(new ParcelOverlay(MapFrontEnd.this, parcelData
 [count]));
         }
 ...
 count++;

 }

 ParcelOverlay.java (necessary snippets):

 public class ParcelOverlay extends Overlay {

         private MapFrontEnd context;
         private Location location;
         private GeoPoint locationPoint;
         private int parcelSize;
         private int price;
         private String priceString;
         private String owner;
         private int buildingCount;
         private int haunted;
         private Bitmap buildingBitmap = null;
         private Bitmap ghostBitmap = null;
         private Bitmap presentBitmap = null;

         private boolean selected = false;

         private int backgroundColor;  // ARGB
         private int gridlineColor;
         private int selectedColor = 0xBBFAFA14;

         private Typeface face;

         // draw variables
         private GeoPoint sizePoint;
         private Paint rectOverlay = new Paint();
         private Paint rectGrid = new Paint();
         private Paint textPaint = new Paint();
         private Paint imagePaint = new Paint();
         Point topLeft = new Point();
         Point bottomRight = new Point();

         Point bottomLeft = new Point();
         Point topRight = new Point();

         public ParcelOverlay(MapFrontEnd _context, ParcelData _parcel) {
             super();
             context = _context;
             locationPoint = new GeoPoint(_parcel.latitude,
 _parcel.longitude);
             parcelSize = _parcel.size;
             price = _parcel.cost;
             owner = _parcel.owner;
             buildingCount = _parcel.buildingNumber;
             haunted = _parcel.haunted;
             prize = _parcel.prize;
             priceString = Integer.toString(price);

             sizePoint = new GeoPoint(locationPoint.getLatitudeE6() +
 parcelSize, locationPoint.getLongitudeE6() + parcelSize);

             face = Typeface.createFromAsset(context.getAssets(), fonts/
 sd_led_screen.ttf);

             setupColors();

                 textPaint.setColor(0xd800);
                 textPaint.setTextSize(25);
                 textPaint.setTypeface(face);
         }

         @Override
         public void draw(Canvas canvas, MapView mapView, boolean shadow) {
                // there are no new objects created in draw
                 if (shadow == false) {
                   ...
                   if (buildingBitmap != null)
                     canvas.drawBitmap(buildingBitmap, (float)(bottomLeft.x + 
 5),
 (float)(topRight.y + 5), imagePaint);

                   if (ghostBitmap != null)
                         canvas.drawBitmap(ghostBitmap, (float)(topRight.x

[android-developers] Memory Leak in my map overlay

2010-01-10 Thread jgostylo
I have been banging away at this one for weeks and I feel like I have
exhausted my research capabilities.  I am hoping that someone will see
my error in the code posted below.  The code is completely functional
doing everything I need, but there is a major memory leak.

When I try to track memory in the DDMS, the VM Heap tells me that my
object count is relatively stable and the used memory is also
relatively stable (it comes back down to a similar value after each GC
after panning).  When I look at the memory pie chart, the free memory
loses over 1meg of capacity with each map pan (overlay reload) and the
Unknown memory grows.  I have not found anything with the allocation
tracker.

Functional Summary:
I load overlays onto a map based on data I get from polling my
server.  When I pan the map far enough I clear the overlays and load
new ones.


MapFrontEnd.java  (snippets):
//header info
private ListOverlay overlays;

//in onCreate
overlays = mapView.getOverlays();
...
// here I attempt to fully clean up my old Overlays
for (Overlay i : overlays)
{
 if (i instanceof ParcelOverlay)
 ((ParcelOverlay) i).cleanUp();
}
overlays.clear();

// and now I create the new overlays and add them to the Overlay list
int count = 0;
while (count  parcelData.length)
{
try
{
overlays.add(new ParcelOverlay(MapFrontEnd.this, parcelData
[count]));
}
...
count++;
}



ParcelOverlay.java (necessary snippets):

public class ParcelOverlay extends Overlay {

private MapFrontEnd context;
private Location location;
private GeoPoint locationPoint;
private int parcelSize;
private int price;
private String priceString;
private String owner;
private int buildingCount;
private int haunted;
private Bitmap buildingBitmap = null;
private Bitmap ghostBitmap = null;
private Bitmap presentBitmap = null;

private boolean selected = false;

private int backgroundColor;  // ARGB
private int gridlineColor;
private int selectedColor = 0xBBFAFA14;

private Typeface face;

// draw variables
private GeoPoint sizePoint;
private Paint rectOverlay = new Paint();
private Paint rectGrid = new Paint();
private Paint textPaint = new Paint();
private Paint imagePaint = new Paint();
Point topLeft = new Point();
Point bottomRight = new Point();

Point bottomLeft = new Point();
Point topRight = new Point();

public ParcelOverlay(MapFrontEnd _context, ParcelData _parcel) {
super();
context = _context;
locationPoint = new GeoPoint(_parcel.latitude,
_parcel.longitude);
parcelSize = _parcel.size;
price = _parcel.cost;
owner = _parcel.owner;
buildingCount = _parcel.buildingNumber;
haunted = _parcel.haunted;
prize = _parcel.prize;
priceString = Integer.toString(price);

sizePoint = new GeoPoint(locationPoint.getLatitudeE6() +
parcelSize, locationPoint.getLongitudeE6() + parcelSize);

face = Typeface.createFromAsset(context.getAssets(), fonts/
sd_led_screen.ttf);

setupColors();

textPaint.setColor(0xd800);
textPaint.setTextSize(25);
textPaint.setTypeface(face);
}

@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
   // there are no new objects created in draw
if (shadow == false) {
  ...
  if (buildingBitmap != null)
canvas.drawBitmap(buildingBitmap, (float)(bottomLeft.x + 5),
(float)(topRight.y + 5), imagePaint);

  if (ghostBitmap != null)
canvas.drawBitmap(ghostBitmap, (float)(topRight.x - 
30), (float)
(topRight.y + 3), imagePaint);

  if (presentBitmap != null)
canvas.drawBitmap(presentBitmap, (float)(topRight.x - 
30),
(float)(bottomLeft.y - 16), imagePaint);
  ...
}
super.draw(canvas, mapView, shadow);
   }

private void setupColors()
{
... //code for setting Paint colors

// set the building bitmap
if (buildingCount  5)
buildingBitmap = BitmapFactory.decodeResource
(context.getResources(), R.drawable.mainstreet);
else if (buildingCount  2)
buildingBitmap = BitmapFactory.decodeResource
(context.getResources(), R.drawable.tradingpost);
else if (buildingCount  0)
buildingBitmap = BitmapFactory.decodeResource
(context.getResources(), R.drawable.generalstore);
else if (buildingCount == 0)
{
if (buildingBitmap != null)
{

[android-developers] Re: ADC2 Results Post

2009-11-05 Thread jgostylo
Congratulations Dan!  It looks like your app is pretty good.  I did
not get to review any apps worth while but I assume there were some
pretty good ones out there.

My app The Great Land Grab ended up in the top 50%.  Interesting to
see that there was a top 25% rating.  I believe I was also hurt by the
fact that my app just did not work outside the US (no data to load).
Nothing in the rules saying that it would not be judged outside the
US, I just assumed it was a US only competition.  My friend said I did
that because I am a xenophobe.  Well if I am then I probably deserve
the loss ;).

On Nov 5, 4:40 pm, Dan Sherman impact...@gmail.com wrote:
 We just got ours :)

 Congratulations! Your application 'ProjectINF ADC' was selected by Android
 users as one of the top 20 in the Arcade category! We're excited that you
 chose to participate in the ADC 2 and wish you luck in the final round as
 your application is evaluated by users and a panel of judges.

 We've got some screenshots over onhttp://www.chickenbrickstudios.com:)

 - Dan

 On Thu, Nov 5, 2009 at 5:21 PM, Maan Najjar maan.naj...@gmail.com wrote:
  I didn't get anything too ...

  On Thu, Nov 5, 2009 at 5:09 PM, f_heft delphik...@gmail.com wrote:

  I didn't get a mail so far ... :(
  Are these mails beeing send over the next few hours or did I somehow
  miss it?

  --
  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.comandroid-developers%2bunsubscr...@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.comandroid-developers%2bunsubscr...@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


[android-developers] Re: ADC2 Results Post

2009-11-05 Thread jgostylo
It sounds like winning e-mails go to the spam box, losing e-mails get
sent to the inbox.  Probably spam rules to weed out bogus contest junk
mail.

On Nov 5, 5:02 pm, Klaus Kartou kar...@gmail.com wrote:
 Just checked the spam folder too...
 Gigbox also made it to the next round...nice :D

 http://www.mygigbox.com

 On Fri, Nov 6, 2009 at 12:01 AM, Vytautas Vaitukaitis 

 vaitukaitis.vytau...@googlemail.com wrote:
  My entry Learn! also made it to the Top 20 in the Education Category!

  Checking the Spam folder is a good idea - the email sent to me was
  also there..

  On 5 Lap, 22:55, CraigsRace craig...@gmail.com wrote:
   Great to see ProjectINF made it.  Amazing game, well done!

   ...still waiting for an e-mail for our entry.

   On Nov 6, 9:40 am, Dan Sherman impact...@gmail.com wrote:

We just got ours :)

Congratulations! Your application 'ProjectINF ADC' was selected by
  Android
users as one of the top 20 in the Arcade category! We're excited that
  you
chose to participate in the ADC 2 and wish you luck in the final round
  as
your application is evaluated by users and a panel of judges.

We've got some screenshots over onhttp://www.chickenbrickstudios.com:)

- Dan

On Thu, Nov 5, 2009 at 5:21 PM, Maan Najjar maan.naj...@gmail.com
  wrote:
 I didn't get anything too ...

 On Thu, Nov 5, 2009 at 5:09 PM, f_heft delphik...@gmail.com wrote:

 I didn't get a mail so far ... :(
 Are these mails beeing send over the next few hours or did I somehow
 miss it?

 --
 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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
  cr...@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.comandroid-developers%2bunsubscr...@googlegroups.comandroid-developers%2Bunsubs
  cr...@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.comandroid-developers%2bunsubscr...@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


[android-developers] Re: adc 2 Second Round

2009-10-28 Thread jgostylo

If Google tells you that posting about it means instant
disqualification then I don't think it would be worth the risk
considering only the people moving forward would know.  But I see your
point.  News like that would almost certainly leak if not from the
people advancing to the next round and that news would definitely
spread considering how many people are searching for those results.

On Oct 26, 3:50 pm, ander...@phdgaming.com ander...@phdgaming.com
wrote:
 I'm sure someone would have posted if this was the case. As far as I
 can tell, there is just no information publicly available at this time
 and all of us are in the dark.

 On Oct 26, 4:04 pm, dadical keyes...@gmail.com wrote:

  My guess is that if you haven't received a notification from Google
  about being in round two by now, you didn't make it.  I'd wager that
  they gave an upgrade period to devs that made the cut so that they
  could deal with the fairly significant issues introduced in the mid-
  contest upgrade to Donut.

  Messy, messy.  Lots of balls in the air and too many jugglers it
  seems...
--~--~-~--~~~---~--~~
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] Re: Getting key for maps....

2009-10-26 Thread jgostylo

I think the issue is that you need to replace the [password]s with
'android' (without the quotes).  Unless I am mistaken, that is the
password for the debug keystore.

On Oct 26, 8:45 am, furby wookie...@gmail.com wrote:
 I am trying to puzzle out how to get an MD5 fingerprint for accessing
 google maps from an android app... So far I have figured out how to
 get keytool to work (The trick on XP is to enclose the entire path to
 the keystore in quotes since it ends up in the Documents and
 Settings folder).

 But the thing is that I keep getting an error that says keytool
 error: java.io.IOException: Keystore was tampered with, or password
 was incorrect. I know for a fact that neither of the passwords are
 incorrect (I can export a signed app from Eclipse using those
 passwords perfectly easily)... And I know that the keystore was not
 tampered with...

 Is there a simple thing I am missing? The command line I am executing
 is (Edited for safety) :

 keytool -list -alias androiddebugkey -keystore C:\Documents and
 Settings\[me]\.android\debug.keystore -storepass [password] -keypass
 [password]

 I am running XP and keytool is located in the C:\Program Files\Java
 \jre1.6.0_07\bin directory, if that helps any
--~--~-~--~~~---~--~~
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] language/region combinations in Europe

2009-09-30 Thread jgostylo

I was wondering if anyone had compiled a list of all the language/
region combinations that are relevant to Android in Europe.

Maybe I am going about this the wrong way.

I am trying to set a server connection string based on where the user
is from (North America, Europe, Russia, China).  I am setting up my
values directory in res but it requires language and region  (ie.
values-en-rGB) and won't work without the language there.  I don't
care about the language currently, but I don't want the app to not
find the correct string if someone has their phone set to en-rFR
(english-France) instead of fr-rFR.

So based on what I am trying to do, I need all the language
possibilities for each region in Europe.

Is this something that would be better solved in code?  It is really
just a couple of strings that get set based on the phone's region
settings.

Thanks!
--~--~-~--~~~---~--~~
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] Sometimes get a blank screen on app restart

2009-09-20 Thread jgostylo

My application flow usually works like this:
Splashscreen calls user agreement
Success from user agreement makes Splashscreen call MapActivity
in MapActivity's onWindowFocusChanged(boolean hasFocus)
{
   if (hasFocus  firstStart)  // firstStart is static boolean
   //start another activity to call user details window
}


Now sometimes (but not always) when a user runs my app, goes back the
the 'desktop' with the home button, and then restarts my app later the
application will just display a blank screen.

Sometimes switching the orientation of the phone will cause the
display to work.  Sometimes it takes switching the orientation a few
times to cause the display to work.  Hitting the back button will kill
the offending activity which is either the user agreement or the user
detail window and the application will continue as normal correctly
displayed.

I am looking for suggestions for what I might be doing wrong or how I
can assure my activities will display when they come up.
--~--~-~--~~~---~--~~
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] Limit EditText to alpha-numeric characters

2009-08-15 Thread jgostylo

I have been searching through the InputFilter documentation trying to
find a good way to do what I want.

I want to create an edittext that only allows alpha-numeric
characters.  I don't think any of the InputText pre-made filters do
this.  I was looking at creating my own filter using
InputFilter.filter, but the documentation seems a little sparse
explaining the method's parameters and what it is looking for.  This
is probably due to my lack of experience with the topic.

Searching the internet, it does not seem like anyone else is trying to
do this so maybe I am not even going about this the correct way.

Any help would be appreciated.
--~--~-~--~~~---~--~~
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] Re: Reliable Http Request needed

2009-08-14 Thread jgostylo

For my purposes it looks like changing servers helped out as well as
increasing my timeouts to 25 seconds.  My game allows for that kind of
latency.

On Aug 5, 7:47 am, jgostylo jgost...@gmail.com wrote:
 I guess as a follow up I would like to say that what is thrown seems
 to always be a SocketTimeoutException.

 My read timeout is 10 seconds and my connection timeout is 15
 seconds.  There is never a case where the server would take more than
 2 or 3 seconds to process a request.
--~--~-~--~~~---~--~~
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] Reliable Http Request needed

2009-08-05 Thread jgostylo

I have a game in development that makes http calls to my server.  The
server handles some database interaction and returns some XML for the
game to parse.  The issue is that the connection seems very
unreliable.  I believe my server is in part to blame for this because
it can be somewhat unresponsive at times, but the frequency is MUCH
greater when communicating with the phone than with a browser on a
computer.  I also notice that it gets worse when 3G is not available
for the phone and it is on the edge network.  Is there any way to code
my app to make it more robust?  Do I need to retry calls X times on
failures?

Here is the code I am using now:
try
{
  URL url = new URL(totalUrl);

  HttpURLConnection con = (HttpURLConnection) 
url.openConnection();
  con.setReadTimeout(1);
  con.setConnectTimeout(15000);
  con.setRequestMethod(GET);
  con.setDoInput(true);

  // Start the query
  con.connect();

  // Read results from the query

  String payload = ;
  String line = null;

  BufferedReader br = new BufferedReader(new InputStreamReader
(con.getInputStream()));
  while ((line = br.readLine()) != null)
  {
  payload += line + \n;
  }
  br.close();

  SAXParserFactory spf = SAXParserFactory.newInstance();
  SAXParser sp = spf.newSAXParser();

  /* Get the XMLReader of the SAXParser we created. */
  XMLReader xr = sp.getXMLReader();

  SAXHandler mySAXHandler = new SAXHandler();
  xr.setContentHandler(mySAXHandler);

  /* Parse the xml-data from our URL. */
  xr.parse(new InputSource(new StringReader(payload)));
}
catch (MalformedURLException e) {
  e.printStackTrace();
  }
  catch (Exception e)
  {
  Log.e(XMLREAD, XML read error, e);
  Intent errorWindow = new Intent(mapActivity, 
ErrorWindow.class);
  errorWindow.putExtra(errorCode, 1);
  gameActivity.startActivity(errorWindow);
  }
  finally {
 if (con != null) {
 con.disconnect();
  }
}

--~--~-~--~~~---~--~~
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] Re: Reliable Http Request needed

2009-08-05 Thread jgostylo

I guess as a follow up I would like to say that what is thrown seems
to always be a SocketTimeoutException.

My read timeout is 10 seconds and my connection timeout is 15
seconds.  There is never a case where the server would take more than
2 or 3 seconds to process a request.
--~--~-~--~~~---~--~~
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] Overlay ConcurrentModificationException

2009-06-26 Thread jgostylo

I am trying to integrate a third party location finding service into
my app and I am using the results of the location to place an overlay
onto my map.  The answer to this question is not use
MyLocationOverlay.  I am moving away from that for non-GPS accuracy
reasons.

When the third party location callback is executed, I update where
this overlay is to reflect the new location.  Doing this makes the
application throw a ConcurrentModificationException.  Here is the full
stack trace:

ERROR/AndroidRuntime(5440): Uncaught handler: thread main exiting due
to uncaught exception
ERROR/AndroidRuntime(5440): java.util.ConcurrentModificationException
ERROR/AndroidRuntime(5440): at java.util.AbstractList
$SimpleListIterator.next(AbstractList.java:66)
ERROR/AndroidRuntime(5440): at
com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:44)
ERROR/AndroidRuntime(5440): at
com.google.android.maps.MapView.onDraw(MapView.java:471)
ERROR/AndroidRuntime(5440): at android.view.View.draw(View.java:
5838)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.drawChild
(ViewGroup.java:1486)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.drawChild
(ViewGroup.java:1484)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
ERROR/AndroidRuntime(5440): at android.view.View.draw(View.java:
5841)
ERROR/AndroidRuntime(5440): at android.widget.FrameLayout.draw
(FrameLayout.java:352)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.drawChild
(ViewGroup.java:1486)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.drawChild
(ViewGroup.java:1484)
ERROR/AndroidRuntime(5440): at android.view.ViewGroup.dispatchDraw
(ViewGroup.java:1228)
ERROR/AndroidRuntime(5440): at android.view.View.draw(View.java:
5841)
ERROR/AndroidRuntime(5440): at android.widget.FrameLayout.draw
(FrameLayout.java:352)
ERROR/AndroidRuntime(5440): at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw
(PhoneWindow.java:1847)
ERROR/AndroidRuntime(5440): at android.view.ViewRoot.draw
(ViewRoot.java:1217)
ERROR/AndroidRuntime(5440): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
ERROR/AndroidRuntime(5440): at android.view.ViewRoot.handleMessage
(ViewRoot.java:1482)
ERROR/AndroidRuntime(5440): at android.os.Handler.dispatchMessage
(Handler.java:99)
ERROR/AndroidRuntime(5440): at android.os.Looper.loop(Looper.java:
123)
ERROR/AndroidRuntime(5440): at android.app.ActivityThread.main
(ActivityThread.java:3948)
ERROR/AndroidRuntime(5440): at
java.lang.reflect.Method.invokeNative(Native Method)
ERROR/AndroidRuntime(5440): at java.lang.reflect.Method.invoke
(Method.java:521)
ERROR/AndroidRuntime(5440): at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
ERROR/AndroidRuntime(5440): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
ERROR/AndroidRuntime(5440): at dalvik.system.NativeStart.main
(Native Method)


I am assuming that this third party callback is not executed in a safe
way.  Is there a paradigm I should follow to make sure that this is
executed safely?  For instance, does anyone know what
MyLocationOverlay does to make sure its callback is executed safely
for updating the overlay?  I could not find source for
MyLocationOverlay.

--~--~-~--~~~---~--~~
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] Re: Handler for map panning

2009-04-28 Thread jgostylo

Ok, I just tried to Override onDraw() in the MapView and it is a final
method so I can't do that.  Then I saw onAnimationEnd() as inherited
from View so I decided to Override that.  I set a break point and pan
around the map but the method never gets executed.

I am still looking for a solution.  The MapController does not appear
to have anything I could use to do this.

On Apr 27, 8:29 pm, jgostylo jgost...@gmail.com wrote:
 I have searched this group extensively and have not found the answer
 to my issue.

 I have a lot of server data being loaded into overlays and I want to
 create the overlays as the user pans.  Ideally it would wait for the
 user to stop panning before it started loading the data.

 What is the best practices procedure for determining if the map has
 changed location or zoom level?  I was looking for something along the
 lines of onLocationChanged() for MapView or onPan() but I have not
 seen anything like that.

 Do I just need to set up my own parameters and Override onDraw() in
 the MapView and in that method run tests to see if the map has
 changed?  This idea seems like overkill and would lead to overzealous
 server hits.

 Anyone have a better idea?

 Thanks.
--~--~-~--~~~---~--~~
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] Re: Handler for map panning

2009-04-28 Thread jgostylo

I am getting the panning recognition to work by overriding
dispatchTouchEvent for MapView.  I think I will just have to separate
out the tasks and do the same thing for the zoom control

On Apr 28, 6:03 am, jgostylo jgost...@gmail.com wrote:
 Ok, I just tried to Override onDraw() in the MapView and it is a final
 method so I can't do that.  Then I saw onAnimationEnd() as inherited
 from View so I decided to Override that.  I set a break point and pan
 around the map but the method never gets executed.

 I am still looking for a solution.  The MapController does not appear
 to have anything I could use to do this.

 On Apr 27, 8:29 pm, jgostylo jgost...@gmail.com wrote:

  I have searched this group extensively and have not found the answer
  to my issue.

  I have a lot of server data being loaded into overlays and I want to
  create the overlays as the user pans.  Ideally it would wait for the
  user to stop panning before it started loading the data.

  What is the best practices procedure for determining if the map has
  changed location or zoom level?  I was looking for something along the
  lines of onLocationChanged() for MapView or onPan() but I have not
  seen anything like that.

  Do I just need to set up my own parameters and Override onDraw() in
  the MapView and in that method run tests to see if the map has
  changed?  This idea seems like overkill and would lead to overzealous
  server hits.

  Anyone have a better idea?

  Thanks.
--~--~-~--~~~---~--~~
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] Handler for map panning

2009-04-27 Thread jgostylo

I have searched this group extensively and have not found the answer
to my issue.

I have a lot of server data being loaded into overlays and I want to
create the overlays as the user pans.  Ideally it would wait for the
user to stop panning before it started loading the data.

What is the best practices procedure for determining if the map has
changed location or zoom level?  I was looking for something along the
lines of onLocationChanged() for MapView or onPan() but I have not
seen anything like that.

Do I just need to set up my own parameters and Override onDraw() in
the MapView and in that method run tests to see if the map has
changed?  This idea seems like overkill and would lead to overzealous
server hits.

Anyone have a better idea?

Thanks.
--~--~-~--~~~---~--~~
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] Re: Animated Map Overlay

2009-02-18 Thread jgostylo

Ok, delving deeper into the source code I have come up with a
solution, though I feel like it is the poor man's solution.

Overlay has two draw methods.  The one that handles animations is this
one:
public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
long when)

In my extended Overlay class I override this method and include code
to draw my animations.  I set up my class with additional control
members:
int animating;  // 0 for not animating; 1 for animating but need a
start time; and 2 for animating and have start time
long startTime;  // holds the start time of the animation
int animationDuration = 700;  // set to have animation last for 700
milliseconds

In the draw method:
if (animating == 1)
{
  startTime = when;
  animating = 2;
}

if (animating == 2)
{
  // draw to canvas code
  return true;
}
else
{
  draw(canvas, mapView, shadow);  // I am not animating so call the
non-animation draw
  return false;
}

The code where you draw to the canvas has to handle your animation.
In my program I am setting the color of a rectangle to animate between
it's color and white.  In my constructor I preset values for how much
the color should change each millisecond.  I use that value to change
the color that much times the number of milliseconds that have passed
from startTime.  ((when - startTime) % animationDuration)

I have not figured out a way to associate an Animation with an
Overlay.  If someone wants to point me in the direction to do that it
would be helpful.  This solution works well enough for me right now
though.
--~--~-~--~~~---~--~~
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] Animated Map Overlay

2009-02-17 Thread jgostylo

I am trying to make a map overlay animated much like MyLocationOverlay
does.

Currently the only things that I can see to make animated are Views
but Overlays don't extend View functionality.  My next thought was to
try to lodge a View into the overlay, but the redundancy makes it seem
like this solution is incorrect.

I grabbed the android source hoping that I could just look at
MyLocationOverlay source and that would let me know how the animation
was supposed to be done, but I can't find the source for anything
involving maps.  If that is available somewhere it would help.

Can someone point me to the MyLocationOverlay source or let me know
what the paradigm is supposed to look like for animating map overlays?

Thanks!
--~--~-~--~~~---~--~~
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] Re: Launching Activity from Overlay onTap

2009-02-11 Thread jgostylo

 This works for me just fine.  I want to launch the browser on a URL that's
 associated with where they tapped:

 container.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri)));

 Works fine.  So the problem must be with finding your activity.  -T

Thanks Tim!  Your words helped me push on and I finally found out
where I was going wrong.  I had been passing the context to my
MyOverlay class incorrectly as getApplicationContext() instead of just
'this' when I declared a new MyOverlay.  When I changed that it
started working.
--~--~-~--~~~---~--~~
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] Launching Activity from Overlay onTap

2009-02-10 Thread jgostylo

I am wondering if I am going about this problem the correct way.

I am making an app that places overlays on top of google maps.  When
you click on the overlay it should launch a dialog type window that
will give you options on what to do with that overlay.

Currently the method I am trying to use is to Override onTap():

Intent myIntent = new Intent(context, MyActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);

The context is the MapActivity that contains the MapView.  It is
passed to the Overlay with the constructor.

It is the line startActivity where the app throws an exception
(ActivityNotFoundException).  I did the setFlags because an error
message said it was needed because I was trying to start the Activity
while outside an Activity.  That makes me think I am going about this
wrong.

I have 'MyActivity' listed in my manifest so I don't think that is the
issue.  I have searched for this problem on the internet and I can't
seem to find anyone else running into this so that is another reason I
think I may be trying to do this the wrong way.

--~--~-~--~~~---~--~~
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] starting Activity in Overlay onTap (dup post?)

2009-02-10 Thread jgostylo

I apologize if this is a duplicate post.  I tried posting this over an
hour ago and there is no indicator that it posted.

I am attempting to launch a dialog type window when I click an Overlay
that has been placed on google maps.  I thought the way I would do
this was Override the onTap() method, create an intent, and call
startActivity on that intent as follows:

Intent myIntent = new Intent(context, MyActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);

It looks like the program throws an ActivityNotFoundException when
executing that last line.  The exception reads that if you try to
start an Activity while you are not in an Activity you need to set the
FLAG_ACTIVITY_NEW_TASK flag which is why that line is there.  I have
included MyActivity in my manifest.

'context' is passed to my class constructor that extends Overlay and
is the MapActivity that I am using to display the map.

Considering how I have not been able to find anyone on the internet
with this problem, I am beginning to think I am going at this all
wrong.  If anyone knows of a good description of how what I am trying
to do is supposed to work or a tutorial doing what I am trying to do,
please post that.

--~--~-~--~~~---~--~~
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] starting Activity in Overlay onTap (dup post?)

2009-02-10 Thread jgostylo

I apologize if this is a duplicate post.  I tried posting this over an
hour ago and there is no indicator that it posted.

I am attempting to launch a dialog type window when I click an Overlay
that has been placed on google maps.  I thought the way I would do
this was Override the onTap() method, create an intent, and call
startActivity on that intent as follows:

Intent myIntent = new Intent(context, MyActivity.class);
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(myIntent);

It looks like the program throws an ActivityNotFoundException when
executing that last line.  The exception reads that if you try to
start an Activity while you are not in an Activity you need to set the
FLAG_ACTIVITY_NEW_TASK flag which is why that line is there.  I have
included MyActivity in my manifest.

'context' is passed to my class constructor that extends Overlay and
is the MapActivity that I am using to display the map.

Considering how I have not been able to find anyone on the internet
with this problem, I am beginning to think I am going at this all
wrong.  If anyone knows of a good description of how what I am trying
to do is supposed to work or a tutorial doing what I am trying to do,
please post that.

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