Friday, February 24, 2012

Loading, Loading, Loading...

Keep that train a' Loading...

With the Introduction of Android 3.0 Honeycomb, came a lot of new features, but one I really have found useful is the implementation of Loaders. Loaders provide the basis for loading data in the background, weather it is from an SQLite Database, Images from a webservice or just a shit-load of items into a list a Loader's are the way to go!

While only a mere 4.4% of Android devices are on 3.0 or higher (as of Feb 1st 2012), Loaders were added to the Android Compatibility Library provides support all the way back to 1.6 (as does Jake Whorton's Action Bar Sherlock library). That's right, support all the way back to DONUT! (Yum) Not only are they super useful, but they are super easy to use. Here's how to go about it:

Thursday, February 16, 2012

Velvety Red

Not the cleanest slice, but still yummy!
So a few years ago I made a Red Velvet Cake for my girlfriend (aka The Panda) for her birthday. I am not a huge fan of chocolate cakes, but this one came out nice and moist and quite delicious. The best part of this cake was the icing, which was NOT cream cheese based. I don't care how your grandmother, who may have even invented the recipe, made the icing, cream cheese icing has no place on anything.

The reason I'm writing about this recipe today is because I made another Red Velvet Cake for my sister's birthday, which wasn't actually red because I had no food coloring. My icing didn't come out quite as good this time around because of the butter I was using (there is NO substitute for real butter when baking) but it was still quite good.

Saturday, February 4, 2012

Ant Build, Install and LAUNCH

After using Eclipse, like all new android developers, for quite some time I got very used to the process of clicking GO and having Eclipse compile, package, install and then launch my android app. The latest ADT build did screw up the build output though, so if you had it set to verbose it would crash while trying to build. I enjoy having a verbose build, I like seeing all the steps.

Well, after my latest OS Re-Install I decided to give IntelliJ IDEA a go. I liked eclipse, but I must say that IntelliJ's Perforce integration is much better, and I like they way it separates different projects. I'm still getting used to it, but I quite like it. However, often times I would try to launch my app and IntelliJ would compile, package and then just sit there. There was a background task running that had a full progress bar and output of "Packaging Android Resources" or something like that. IntelliJ also has no verbose build output for android compiling, which is quite frustrating.

I've been wanting to learn more with Ant anyway, so I decided to just start building with the command line. Here's a piece of advice if you're using Intellij and going to build with Ant... do NOT use the "Generate And Build... option. The file it generates does will compile everything fine, but it won't package it into your apk for you. Not sure it converted your classes to dex either. So, to get your build.xml file for Ant, use the command:

android update project -p <path to project>


This will create your build.xml file as well as multiple properties files. local.properties contains properties to JDK and the Android SDK, and you can put anything else that is specific to your machine here. ant.properties contains any properties you want to adjust for the project and can be added to a SCM system without worrying about local machine settings. The last file, project.properties, is generated from reading your AndroidManifest.xml file, and will be re-generated, so don't modify it!

This was working well except for one thing... The "ant debug install" command would build my project, package my apk with my debug key and install it to my device. It would not however launch my Launcher activity. So in my build.xml file I added a custom target, launch, which depends on install, to scan the xml file for the package and name of the LAUNCHER activity and start it using adb.