Android – UK Highways Agency Traffic App

I have been getting back into Android programming again. To easy myself back into it and also force myself to use Android Studio I have put together a nice road traffic application. This kind of app covers a lot of the Android API so it’s a great way to update myself on the changes to the API.

The code is up on github here.

Let’s cover some of the interesting stuff.

Recycler List View

So this uses the new Android list component, the RecyclerView. In my previous post you can see my prototyping of the list as I wanted to get it right. I think it turned out okay and it’s a better example than most of the ones kicking around the net. Any dummy can built a list with one text item. It’s when you want to have icons and multiple text lines that the noddy demos than people post all fall down. So here is a decent example of something you might actually want to build.

list

I am using a image cache to cache the severity icons. You will see that the icons are categorised by type too. I just need to get around to generating some images.

Data Loader

The data is loaded using an RSS parser library I built a while back and have been meaning to use for some time. Data is pulled by a background task using Androids Loader API. This is the recommended component to do this now. In the past I had to roll my own threaded component.

Navigation Drawer

I want to do a bit more with this but in the meantime this is the drawer generater from the standard demo provided with Android Studio. I have tweaked it to load a list of traffic regions defined my an OPML file read locally to the application.

drawer

This is a nice way to this do this. The regions are not hard coded into the code.

Easy CP

My content provider library really shines here. It was so easy to define the domain object and write the code to read and write to persistence. If you haven’t already seen it check out EasyCP on github.

Android Studio

Finally, my take on Android Studio. Meh..it’s okay. Is Eclipse a better IDE? Yes. Can I understand why Google might want to have their own IDE? Yes, I think I can see why. I guess it’s about control and they don’t have any control over Eclipse. Now they’ve got control of the IDE and the build system. Despite the fact that 1998 called and wants it’s UI back. Also, just remember IntelliJ are not going to hand the over their core business to Google so don’t expect to be able to load in any old java project to AS any time soon. Google are always going to have to cripple this IDE in some fashion to avoid stepping on IntelliJ toes. Writing this application I had to switch back and forth between Eclipse and AS which was a bit of a pain in the arse. Anyway, we’ll see where they go with this.

Comments

Leave a Reply