A brief annoyance that I was dealing with:
For testing purposes I wanted a service to initiate a status bar notification. I couldn't understand why, but for some bizarre reason Android kept failing miserably when trying to load the resource for my notification's icon. I kept seeing stuff in my ddms logs about android.content.res.Resources$NotFoundException.
I checked my code and my resources over and over again. I blew away the gen directory and rebuilt my app from scratch. I scoured StackOverflow for a situation similar to mine, yet nothing quite the same came up.
After pulling my hair for an hour or two, I inadvertently realized what the problem was.
I'm running CyanogenMod 7.1 on my phone. I had it set to forcibly install apps to my phone's SD card. Unfortunately for me, my app doesn't include any SD card support whatsoever.
*facepalm*
Problem solved: I moved the app into my phone's internal memory. I also decided to end my little experiment with forcing new installs onto the SD card.
Bloody hell!
Monday, October 24, 2011
Adventures in Android, Part II
Posted by Aaron at 07:00 0 comments
Labels: code
Sunday, October 02, 2011
Adventures in Android, Part I
I've spent most of this afternoon and evening working on my first Android app.
I was dissatisfied with the current slate of applications that are available for a particular problem domain, so I have decided to write my own.
More details will follow as my work approaches completion, but in the meantime I'm going to jot down some thoughts about the stuff that I worked on today.
- I haven't written a line of Java in probably seven or eight years because I think that it sucks. It wasn't difficult to get back into it, though I still don't like it.
- I hate checked exceptions; they make the compiler annoying enough to motivate you to write suppressing catch blocks just so that your code will compile (Doing so is a bad idea, of course, so suck it up and do the right thing).
- The APIs I wanted to use were not available publicly until Honeycomb. I want my app to run on Eclair. I ended up using reflection to give me the appropriate interfaces depending on availability: I use the documented API if it's available, but if I catch a NoSuchFieldException then I fall back to the undocumented APIs. I am amused that my first Android app, the one that I am writing to teach myself, is using undocumented APIs; I did the same thing when I started hacking 16-bit Windows code in 1995. It's actually a bit easier this time around because I may browse the entire source code. When I taught myself Windows I didn't have that luxury, though I always had my trusty copy of Undocumented Windows sitting nearby (I still have that book)!
- I haven't used Eclipse since the last time that I wrote code in Java. This time around, I am proud to say that I successfully resisted using Eclipse for my Android work. I was worried that command-line environments were going to be an afterthought when it came to the Android developer tools but I was pleasantly surprised to be proven wrong. Vim and Ant FTW!
- ddms is really cool.
- Today's work passed testing! svn commit
<digression>This experience reinforces my opinion that hiring developers based on their ability to satisfy a laundry list of keywords is ridiculous. Good developers don't need a year to pick up whatever technologie du jour you're pushing. Whatever your buzzwords are, they'll probably be obsolete in five years anyway.</digression> That's another topic for another day.
Posted by Aaron at 21:46 0 comments
Labels: code
Wednesday, June 22, 2011
You're entitled to your opinion, but don't be hypocritical about it
In today's Globe and Mail, we have New Democrat MP Pat Martin suggesting that one effective mechanism for abolishing the Senate without amending the constitution would be to cut off its funding.
It's no secret that the NDP wants to abolish the Senate. While I don't agree with this option (and certainly don't agree with the hypocrisy surrounding minimum seat guarantees in the House), I certainly don't dispute that abolition is a legitimate alternative. What I do find interesting is that Mr. Martin's Senate reform strategy is quite similar to the Conservatives: Avoid amending the constitution, but adjust the parameters around which the Senate operates.
Hopefully while the Senate Reform Act is before the House, Mr. Martin will be cognizant of the fact that, while he may not agree with the reforms contained within those bills, he is a proponent of using parliament as the mechanism for reform. Were he to suddenly declare that a constitutional amendment is required, it would be nothing short of hypocritical.
Posted by Aaron at 13:14 0 comments
Labels: CanadianPolitics, musings