Saturday, May 16, 2009
Things I learned about Android today
Since I'm at the foothill of the learning curve, I figure I should document as I go, as I'm learning more now than I will later. Spent most of the day coding, except for a break to go to yoga, and progress is good. Am about to go for beer, but before I do, a point-form list of what I learned and relearned today:
OK, beer beckons, more next week.
- 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.
Labels: Android, AndroidManifest, cancellation
Comments:
<< Home
Good evening world! “Can I trust you to write my term paper cheap? Why should I rely on you to do my task?” We are a dependable paper rater com service that has earned the trust and loyalty of students across the board. This trust has been cultivated through years of sticking by these guarantees
Subscribe to Post Comments [Atom]
<< Home
Subscribe to Posts [Atom]
Post a Comment