[android-developers] Re: Weird Map Problem (Controlling same map)

2008-12-10 Thread BobW

Mark,
Great book.  I recommend it to all.
I like the subscription model also.  Very cool.

Bob

On Dec 10, 7:57 am, Justin (Google Employee) [EMAIL PROTECTED]
wrote:
 I'm glad that you've found a solution that works for you. Yes,
 unfortunately while we expect most Android devices to be pretty
 powerful and have fairly large amounts of memory, they still aren't
 desktop machines and more careful design and implementation will
 sometimes be necessary.

 Cheers,
 Justin
 Android Team @ Google

 On Dec 9, 5:42 pm, mscwd01 [EMAIL PROTECTED] wrote: Hi Justin,

  I too have spent a great deal of time debugging this - with little
  luck.
  Thanks for taking the time to explain your findings, it does help to
  understand what was going on.

  In the end I chose to redesign my application and use just the one
  MapView - mainly due to the memory issues.

  The reason I found myself in this problem was due to the fact I needed
  a TabHost and a MapView in the same activity. However I found I
  couldn't extend both a TabActivity and MapActivity in the same
  Activity so I opted to create my own TabbedMapActivity, created
  using the Android source code.

  I explained it all here if you want to see how I achieved 
  this:http://groups.google.com/group/android-developers/browse_thread/threa...

  Ultimately, I believe you are right, having multiple MapViews will
  inevitable lead to memory issues regardless of how careful you are to
  save map states and recycle resources; so I think using just the one
  MapView is the only answer at this moment in time.

  Thanks

  On Dec 9, 11:49 pm, Justin (Google Employee) [EMAIL PROTECTED]
  wrote:

   Once upon a time I spent a lot of time debugging this issue, so here
   is what I found.

   ***WARNING: This information was valid on an internal version of the
   SDK between M5-RC15 and 0.9 beta, it may no longer be valid, test
   thoroughly and proceed with  caution.***

   First, some information about MapView and MapActivity. Each Android
   process may have multiple MapViews and MapActivitys, but they all
   manipulate a single MapView backing object. This is because MapViews
   take a *huge* amount of memory, roughly half of the 16MB allowed to
   each application. This *also means* you need to be very careful about
   your memory usage when using MapView. Make sure to use DDMS to analyze
   memory usage to make sure you don't run out of space. Because a single
   view backs all map views in an application, you also need to save and
   restore the map state (including center position and zoom) when your
   MapActivity subclass pauses/resumes.

   For the purposes of discussion I will refer to two activities,
   ActivityAlpha and ActivityBeta, each is a subclass of MapActivity and
   has a MapView. ActivityAlpha starts ActivityBeta. The user will
   eventually return to ActivityAlpha either via the 'back' button or
   ActivityBeta finishing naturally.

   When ActivityBeta finishes, there are two issues that I believe causes
   the problem you see:

   1) onCreate is not called on the launching ActivityAlpha, onResume is
   2) a certain UI focal change doesn't occur

   Certain initialization of the MapView and various helper entities are
   done by MapActivity when onCreate is called. When ActivityBeta is
   launched, onPause is called on ActivityAlpha and the helpers for the
   MapView are stopped. onResume does some of the restarting, but clearly
   not all that is necessary. This can be worked around by calling
   super.onCreate(null) from your onResume or onActivityResult method of
   your launching MapActivity subclass. ***WARNING***: This is
   potentially very dangerous, MapActivity may not expect to be abused
   this way, test thoroughly and proceed with caution.

   The second issue results in the above hack not quite working. When
   ActivityBeta finishes, and the above hack is applied, ActivityAlpha is
   ready to load tiles, but it won't until the MapView is touched so that
   the MapView checks to see if it needs tiles. So far, I don't have a
   workaround for this, possibly a programmatic pan or zoom would cause
   the MapView to load any missing tiles. Some of my previous testing
   also indicated that any missing tiles would load when ActivityAlpha
   resumes if you use startActivity() to start ActivityBeta instead of
   startActivityForResult().

   The bottom line is that maps were never designed to have multiple map
   views in a single application, they're very heavy objects. Hopefully
   this helps and is still valid information, let me know how it goes.

   Cheers,
   Justin
   Android Team @ Google

   On Dec 8, 5:39 pm, mscwd01 [EMAIL PROTECTED] wrote:

Having tried the test you suggested it seems I can go back and forth
between my Activity1 map and the inbuilt Google Maps app perfectly
fine - no memory worries. However my application, constantly throws up
OutOfMemory errors.

One thing I have noticed is after Activity1 calls 

[android-developers] Debugging applications with Google MAP api on an actual device

2008-12-04 Thread BobW

When I run my map application in the debugger, I can see the map on
the emulator (I have a MAP key for my debugger from Google), but I
can't see it from my actual device.
I can get a release key from Google, and sign a apk with my
certificate, but I am not sure how to install it on the device or how
to debug the application on the actual device.

Any advice would be appreciated.

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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---