Android App Development Quandary
I have a grand total of one Android application in the Play Store, Cub Tracker. It serves two functions for me: it helps me manage my sons' Cub Scout den, and it gives me a means for experimentation in the mobile realm. For the most part, it has done well for me on both counts for the past few years. I am currently faced with an issue of new functionality (which is mostly irrelevant for this discussion) that has brought up a question in the realm of experimentation. This post is a discussion of my options which will allow me to think out loud, if you will, as well as getting (I hope) some feedback on my options.
Book Review: 50 Android Hacks
50 Android Hacks by Carl Sessa is, as you may have deduced from the title, a collection of 50 tips and tricks to help Android developers of all skill levels handle a variety of problems. For the most part, I found the book very helpful. Before I get to that, I have a minor quibble: I’m not sure "hacks" was the best choice of words. I understand the marketing aspect of it, but when I hear "hack", I think of a piece of code I’m embarrassed to share with someone else, of something I’d prefer to hide. These "hacks" seem anything but. Clean, clear, efficient, something to be proud of. It’s a minor quibble, of course, but there it is. :)
The book itself is pretty easily laid out. If you’ve read a "cookbook", then you should be comfortable and familiar with the basic layout. Each chapter is a different tip, which range from the "easy" (e.g., centering text in a view) to the more advanced (e.g., using the SyncAdapter). The topics covered include layouts, animations, build tools and more.
I read this, appropriately enough, using the Kindle App on my Android tablet, and the experience was very good. I’ve read several programming books on my tablet, and they usually have issues with unreadable source code, large blanks due to content flow issues, etc. Some of this is affected, of course, by the font size and is fixable, but I saw none of those issues here. All of the source, both XML and Java, were neatly formatted and readable, with no odd, jarring line wrap issues. The graphics were crisp and readable, and the pages were neat and clean.
This is a great book, especially for beginning to intermediate Android developers, but I’d wager that there’s something here for just about everyone.
I’ve been getting a number of bug reports from my app Cub Tracker that had me stumped. I was getting NullPointerExceptions where I shouldn’t be. After some digging, I think I finally found the culprit: device rotation. While rotating the device does, indeed, trigger the error, it goes deeper than that. My problem is that the app doesn’t correctly save the state of the view, which becomes problematic when, for example, the device is rotated. In trying to fix that, I discovered I don’t understand the Android lifecycle as well as I should, so I set out to fix that.
Setting Up Droidium for Android Testing
Many know Arquillian as a great integration, functional, acceptance testing platform. Until recently, I thought of it solely as a great Java EE tool, but an Arquillian extension, known as Droidium, allows you to use Arquillian to help drive your Android testing. I spent some time tonight trying to get it set up for Cub Tracker and thought I’d share what (little) I have so far.
Syncing Playlists with Android Devices
While I love my Android devices, one thing that has always bugged me is syncing music with them. Sure, there are some apps that claim to be able to do it, but I’ve never found one that will do what it says and be a decent music player at the same time (perhaps someone out there can point me to a good one). For the most part, then, I’ve settled on Banshee (which, as far as I can tell, doesn’t sync, but is a decent player1). Here, then, is my very manual process for syncing music.
Error Reporting for Android Apps
As every Android developer knows, application crashes are reported back to Google and can be view in the Play Developer’s Console. This is helpful, but, in my experience, sometimes you don’t get enough context. You also don’t get notifications when crashes are reported. Fortunately, there is a tool, called ACRA, that improves the situation quite a bit. In this post, I’ll give you a brief introduction to the tool, and how I use it in Cub Tracker.
Simulating Swipes in Your Android Tests
As some of you may or may not know, I have small Android project, Cub Tracker, that I’ve been working on for quite some time now in my spare time. I’ve been trying to be better about quicker releases, but all the testing for the app is currently manual (and, therefore, hit-and-miss), so updates tend to be a bit slower and very cautious. (For the record, it used to have pretty decent tests, but I rewrote the app for version 2 and just never got around to porting/rewriting the tests.) My next change, though, will be pretty invasive, so I’ve decided it’s time to fix that. In doing so, though, I hit a snag pretty quickly. Cub Tracker now uses a ViewPager as the main form of navigation, and I quickly realized I didn’t know how to swipe from one page to another. It turns out there are several different ways to do it. Here are some…
Testing Android Applications with Maven, Android-x86 and VirtualBox
For a few months now, I’ve been working on a small application called Cub Tracker which is designed to help Cub Scout den and pack leaders track the progress of the scouts assigned them. I’m a big fan of testing, so I’ve done my best to follow TDD as I’ve worked on the app. Early on, it became clear that I needed a better way to test, as the official Android app is slow and unreliable at times. Via Twitter, I was turned on to Android-x86 and after a couple nights of hacking, I think I have a usable installation of Android-x86 under VirtualBox that has sped up my testing considerably. In this article, I’ll show you how I did it.
Android at the OKC JUG
Today, I presented basic Android development at the Oklahoma City JUG. In the presentation, we walked through a very simple (and very ugly) note-taking application. The app allows the user to list, view, add, edit, and delete notes. There are no bells and whistles in the app, as I was trying to find something that is non-trivial enough to be interesting, yet no so complex that the audience gets lost in all the details. Overall, I think I succeeded there, though I guess the evaluation slips should tell me how far off I really was. :)
As I said at the start of the talk, it’s not a pretty app, and I likely violate many of the best practices the Google and other experts suggest, but it’s a functional app and, for that reason alone, I think, a decent start. I’ve pushed the sources to GitHub so anyone can take a look at it, fork it, etc. As time permits, I hope to clean the code up some, and add, via comments, some of the discussion we had in the talk itself. That will likely make the code a bit more valuable and interesting.
Thanks to all who attended, especially those who shouted out hints for things I broke. :P
My First Android App: Cub Tracker
Over the weekend, I published my first Android application, Cub Tracker. Cub Tracker is really a pretty simple application, but one born out of a personal need. My oldest son is a Cub Scout Wolf, and I am his den leader. There have been countless times where we had been out somewhere, and my wife and I would ask each other, "I wonder if there’s a Cub Scout achievement or elective for this?" At the time, there was no easy to find out. There are web sites that list these, of course, but it wasn’t convenient to load the page and search it while we’re in the middle of something.
Given what I do for a living, I immediately thought, "There should be an app for that!" and Cub Tracker was born. I won’t go into all the details here (there’s a site for that, though it’s pretty bare at the moment), but Cub Tracker allows you to track the achievements and electives of one or more Cub Scouts on your mobile device. It will also generate a report that can be emailed to, say, your Scout’s den leader.
It’s not flashy and probably isn’t very exciting for many people, but I’m pretty proud of it and expect I’ll get a lot of use out of it. If you have a Scout, please check it out and let me know what you think.
A Comparison Table of 4 Android Phones
I’ve been an iPhone user for about 1.5 years now. I’m mostly happy with it, but I’d kinda like to write applications for it. The problem, though, is that the iPhone uses Objective-C (and I don’t consider writing web apps the same thing as writing an iPhone app ; ). Enter Google’s Android. I can use my existing Java knowledge to write applications for an Android device, giving me a much smaller learning curve. The question, then, is which device should I get? There are several available, unlike the iPhone, so the choice can be difficult.
Recently, I ran across 6 of the Best Android Mobile Devices, which has a pretty nice run down of six different devices, not all of which are phones. The problem with this particular comparison, was that each phone was on a different page, making comparison more difficult as I had to switch tabs a lot. My solution, then, is the table below. Inspired by the link above, though taking most of the data from the devices' product pages, I’ve compiled the following table. Obviously, this isn’t every Android phone on the market. I took the three listed in the article above, and added one other phone that I’ve been considering. Hopefully this table will be helpful in those looking at these devices.