And there are of course other ways to do this -- have a PolygonCursor object for instance that lets you iterate over the cursor and provides an API to get the polygon data for the current position.
On Wed, May 13, 2009 at 11:40 AM, Mark Murphy <mmur...@commonsware.com>wrote: > > > Please bear in mind that you are writing applications to run on mobile > > devices whose horsepower is reminiscent of PCs from a decade ago. > > > > Programming techniques that you might use on a current PC with tons of > > RAM, fast CPUs, and access to constant AC power are not necessarily > > recommended in a mobile device environment. > > At the risk of replying to myself, let me clarify. > > Creating more garbage to gain cleaner APIs is a trade-off. Created garbage > may affect your application, and it may affect other applications -- we've > had complaints on this list already from game developers who cannot > maintain consistent frame rates because of garbage collection in other > applications. > > Similarly, adding extra VM instructions, to create DatabasePolygon objects > and pull data out of Cursors, chews up battery life. > > You did not indicate whether you database will have one or 10,000 > polygons. The magnitude of the extra garbage and instructions will be tied > to the number of polygons you create. > > So, while I agree with you that dealing with Polygon objects may be tons > cleaner than dealing with Cursors, bear in mind there is a cost involved, > and be sure to weigh that cost when deciding what to do. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! > > > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---