Saturday, May 16, 2009
Things I learned about Android today
- To use either camera or location data in a package , you have to add a permission entry to its AndroidManifest.xml.
- Also, when you add an Activity, don't forget to add it to the manifest.
- "this" in an anonymous inner class refers, of course, to the inner class. Duh.
- I've stumbled into an interesting problem with cancellation. Because any Android activity can be preempted and/or killed at any time, you have to be ready to save the current state. But in order to provide a cancel button, you also have to save the initial state. Which may mean, if you're using a database for storage, that you have to have two DB rows allocated to the current UI. And bear in mind that more than one copy of your Activity might be running at any given time ... I have some notion how I might deal with this, but am hoping some more elegant solution will arise.
- The XML-file layout structure is a bit clunky, but both powerful and flexible.
- That said, I still haven't worked out how to make a ListView's entries selectable across their entire width, rather than just on their text field. (And woe betide you if that text field is empty ...)
- To create and use a custom View subclass, you have to add a new xml namespace to the layout file, and provide all the necessary constructors. (And, um, it's also important to spell its package name correctly.)
- The camera is remarkably easy to work with. So far.
- Location information is, too, but it doesn't seem to sit well with the emulator; I've tried two different ways to simulate a particular location, but am still getting null back when I ask the emulator where it is.
- Running test cases in the emulator's context works pretty well. Debugger, too.
OK, beer beckons, more next week.
Subscribe to Posts [Atom]